lithium\util\Validator::rules PHP Метод

rules() публичный статический Метод

Returns a list of available validation rules, or the configuration details of a single rule.
public static rules ( string $name = null ) : mixed
$name string Optional name of a rule to get the details of. If not specified, an array of all available rule names is returned. Otherwise, returns the details of a single rule. This can be a regular expression string, a closure object, or an array of available rule formats made up of string regular expressions, closures, or both.
Результат mixed Returns either an single array of rule names, or the details of a single rule.
    public static function rules($name = null)
    {
        if (!$name) {
            return array_keys(static::$_rules);
        }
        return isset(static::$_rules[$name]) ? static::$_rules[$name] : null;
    }

Usage Example

Пример #1
0
 /**
  * Tests that the rules state is reset when calling `Validator::__init()`.
  */
 public function testStateReset()
 {
     $this->assertNull(Validator::rules('foo'));
     Validator::add('foo', '/foo/');
     $this->assertEqual('/foo/', Validator::rules('foo'));
     Validator::__init();
     $this->assertNull(Validator::rules('foo'));
 }
All Usage Examples Of lithium\util\Validator::rules