presence_of.php 715 B

1234567891011121314151617181920212223242526272829
  1. <?php namespace System\Validation\Rules;
  2. use System\Validation\Nullable_Rule;
  3. class Presence_Of extends Nullable_Rule {
  4. /**
  5. * Evaluate the validity of an attribute.
  6. *
  7. * @param string $attribute
  8. * @param array $attributes
  9. * @return bool
  10. */
  11. public function check($attribute, $attributes)
  12. {
  13. if ( ! is_null($nullable = parent::check($attribute, $attributes)))
  14. {
  15. return $nullable;
  16. }
  17. // ---------------------------------------------------------
  18. // The Nullable_Rule check method essentially is a check for
  19. // the presence of an attribute, so there is no further
  20. // checking that needs to be done.
  21. // ---------------------------------------------------------
  22. return true;
  23. }
  24. }