public static function validate($data, $rules)
	{
		$errors = array();

		foreach ($data as $k => $v)
		{
			if (array_key_exists($k, $rules))
			{
				// (Re)set rule variable
				$rule = null;

				if (is_callable($rules[$k]))
				{
					if ($error = call_user_func_array($rules[$k], [$data]))
					{
						$errors[] = $error;
					}
				}
				else if (strpos($rules[$k], '|'))
				{
					$rule = explode('|', $rules[$k]);
				}
				else
				{
					$rule = array($rules[$k]);
				}

				if (isset($rule))
				{
					foreach ($rule as $r)
					{
						if (method_exists(__CLASS__, $r))
						{
							if ($error = self::$r($k, $v))
							{
								$errors[] = $error;
							}
						}
					}
				}
			}
		}

		return (count($errors) > 0) ? $errors : true;
	}
public static function validate($data, $rules)
	{
		$errors = array();

		foreach ($data as $k => $v)
		{
			if (array_key_exists($k, $rules))
			{
				// (Re)set rule variable
				$rule = null;

				if (is_callable($rules[$k]))
				{
					if ($error = call_user_func_array($rules[$k], [$data]))
					{
						$errors[] = $error;
					}
				}
				else if (strpos($rules[$k], '|'))
				{
					$rule = explode('|', $rules[$k]);
				}
				else
				{
					$rule = array($rules[$k]);
				}

				if (isset($rule))
				{
					foreach ($rule as $r)
					{
						if (method_exists(__CLASS__, $r))
						{
							if ($error = self::$r($k, $v))
							{
								$errors[] = $error;
							}
						}
					}
				}
			}
		}

		return (count($errors) > 0) ? $errors : true;
	}
public static function validate ( $ data , $ rules ) { $ errors = array ( ) ; foreach ( $ data as $ k => $ v ) { if ( array_key_exists ( $ k , $ rules ) ) { // (Re)set rule variable $ rule = null ; if ( is_callable ( $ rules [ $ k ] ) ) { if ( $ error = call_user_func_array ( $ rules [ $ k ] , [ $ data ] ) ) { $ errors [ ] = $ error ; } } else if ( strpos ( $ rules [ $ k ] , '|' ) ) { $ rule = explode ( '|' , $ rules [ $ k ] ) ; } else { $ rule = array ( $ rules [ $ k ] ) ; } if ( isset ( $ rule ) ) { foreach ( $ rule as $ r ) { if ( method_exists ( __CLASS__ , $ r ) ) { if ( $ error = self :: $ r ( $ k , $ v ) ) { $ errors [ ] = $ error ; } } } } } } return ( count ( $ errors ) > 0 ) ? $ errors : true ; }
Do validation checks on provided data

@param   array       $data   The fields to validate
@param   array       $rules  The rules upon which to validate
@return  array|bool
@since   2.0.0
Do validation checks on provided data