presence_of.php 715 Bytes
Newer Older
1 2
<?php namespace System\Validation\Rules;

3
use System\Validation\Nullable_Rule;
4

5
class Presence_Of extends Nullable_Rule {
6 7 8 9 10 11

	/**
	 * Evaluate the validity of an attribute.
	 *
	 * @param  string  $attribute
	 * @param  array   $attributes
12
	 * @return bool
13 14 15
	 */
	public function check($attribute, $attributes)
	{
16
		if ( ! is_null($nullable = parent::check($attribute, $attributes)))
17
		{
18
			return $nullable;
19 20
		}

21 22 23 24 25
		// ---------------------------------------------------------
		// The Nullable_Rule check method essentially is a check for
		// the presence of an attribute, so there is no further
		// checking that needs to be done.
		// ---------------------------------------------------------
26 27 28 29
		return true;
	}

}