fuel/fuel/core/classes/validation.php
protected function _find_rule($callback)
	{
		// Rules are validated and only accepted when given as an array consisting of
		// array(callback, params) or just callbacks in an array.
		if (is_string($callback))
		{
			$callback_method = '_validation_'.$callback;
			foreach ($this->callables as $callback_class)
			{
				if (method_exists($callback_class, $callback_method))
				{
					return array($callback => array($callback_class, $callback_method));
				}
			}
		}

		// when no callable function was found, try regular callbacks
		if (is_callable($callback))
		{
			if ($callback instanceof \Closure)
			{
				$callback_name = 'closure';
			}
			elseif (is_array($callback))
			{
				$callback_name = preg_replace('#^([a-z_]*\\\\)*#i', '',
					is_object($callback[0]) ? get_class($callback[0]) : $callback[0]).':'.$callback[1];
			}
			else
			{
				$callback_name = preg_replace('#^([a-z_]*\\\\)*#i', '', str_replace('::', ':', $callback));
			}
			return array($callback_name => $callback);
		}
		elseif (is_array($callback) and is_callable(reset($callback)))
		{
			return $callback;
		}
		else
		{
			$string = ! is_array($callback)
					? $callback
					: (is_object(@$callback[0])
						? get_class(@$callback[0]).'->'.@$callback[1]
						: @$callback[0].'::'.@$callback[1]);
			\Error::notice('Invalid rule "'.$string.'" passed to Validation, not used.');
			return false;
		}
	}
protected function _find_rule($callback)
	{
		// Rules are validated and only accepted when given as an array consisting of
		// array(callback, params) or just callbacks in an array.
		if (is_string($callback))
		{
			$callback_method = '_validation_'.$callback;
			foreach ($this->callables as $callback_class)
			{
				if (method_exists($callback_class, $callback_method))
				{
					return array($callback => array($callback_class, $callback_method));
				}
			}
		}

		// when no callable function was found, try regular callbacks
		if (is_callable($callback))
		{
			if ($callback instanceof \Closure)
			{
				$callback_name = 'closure';
			}
			elseif (is_array($callback))
			{
				$callback_name = preg_replace('#^([a-z_]*\\\\)*#i', '',
					is_object($callback[0]) ? get_class($callback[0]) : $callback[0]).':'.$callback[1];
			}
			else
			{
				$callback_name = preg_replace('#^([a-z_]*\\\\)*#i', '', str_replace('::', ':', $callback));
			}
			return array($callback_name => $callback);
		}
		elseif (is_array($callback) and is_callable(reset($callback)))
		{
			return $callback;
		}
		else
		{
			$string = ! is_array($callback)
					? $callback
					: (is_object(@$callback[0])
						? get_class(@$callback[0]).'->'.@$callback[1]
						: @$callback[0].'::'.@$callback[1]);
			\Error::notice('Invalid rule "'.$string.'" passed to Validation, not used.');
			return false;
		}
	}
protected function _find_rule ( $ callback ) { // Rules are validated and only accepted when given as an array consisting of // array(callback, params) or just callbacks in an array. if ( is_string ( $ callback ) ) { $ callback_method = '_validation_' . $ callback ; foreach ( $ this -> callables as $ callback_class ) { if ( method_exists ( $ callback_class , $ callback_method ) ) { return array ( $ callback => array ( $ callback_class , $ callback_method ) ) ; } } } // when no callable function was found, try regular callbacks if ( is_callable ( $ callback ) ) { if ( $ callback instanceof \ Closure ) { $ callback_name = 'closure' ; } elseif ( is_array ( $ callback ) ) { $ callback_name = preg_replace ( '#^([a-z_]*\\\\)*#i' , '' , is_object ( $ callback [ 0 ] ) ? get_class ( $ callback [ 0 ] ) : $ callback [ 0 ] ) . ':' . $ callback [ 1 ] ; } else { $ callback_name = preg_replace ( '#^([a-z_]*\\\\)*#i' , '' , str_replace ( '::' , ':' , $ callback ) ) ; } return array ( $ callback_name => $ callback ) ; } elseif ( is_array ( $ callback ) and is_callable ( reset ( $ callback ) ) ) { return $ callback ; } else { $ string = ! is_array ( $ callback ) ? $ callback : ( is_object ( @ $ callback [ 0 ] ) ? get_class ( @ $ callback [ 0 ] ) . '->' . @ $ callback [ 1 ] : @ $ callback [ 0 ] . '::' . @ $ callback [ 1 ] ) ; \ Error :: notice ( 'Invalid rule "' . $ string . '" passed to Validation, not used.' ) ; return false ; } }
Takes the rule input and formats it into a name & callback

@param   string|array  short rule to be called on Validation callables array or full callback
@return  array|bool    rule array or false when it fails to find something callable
Takes the rule input and formats it into a name & callback