src/Checker.php
public static function set($name, $handler = null)
    {
        if (!is_array($name)) {
            $name = [$name => $handler];
        }
        static::$_handlers = static::$_handlers + $name;
    }
public static function set($name, $handler = null)
    {
        if (!is_array($name)) {
            $name = [$name => $handler];
        }
        static::$_handlers = static::$_handlers + $name;
    }
public static function set ( $ name , $ handler = null ) { if ( ! is_array ( $ name ) ) { $ name = [ $ name => $ handler ] ; } static :: $ _handlers = static :: $ _handlers + $ name ; }
Sets or replaces one or several built-in validation rules.

For example:
{{{
Checker::set('zeroToNine', '/^[0-9]$/');
$isValid = Checker::isZeroToNine("5"); // true
$isValid = Checker::isZeroToNine("20"); // false
}}}

Alternatively, the first parameter may be an array of rules expressed as key/value pairs,
as in the following:
{{{
Checker::set([
'zeroToNine' => '/^[0-9]$/',
'tenToNineteen' => '/^1[0-9]$/',
]);
}}}

In addition to regular expressions, validation rules can also be defined as full anonymous
functions:
{{{
use app\models\Account;

Checker::set('accountActive', function($value, $options = [], &$params = []) {
$value = is_int($value) ? Account::first($value) : $value;
return (boolean) $value->is_active;
});

$testAccount = Account::create(['is_active' => false]);
Checker::isAccountActive($testAccount); // returns false
}}}

These functions can take up to 3 parameters:
- `$value`  _mixed_ : This is the actual value to be validated (as in the above example).
- `$options` _array_: This parameter allows a validation rule to implement custom options.
- `'check'` _string_: Often, validation rules come in multiple "formats", for example:
credit cards, which vary by type of card. Defining multiple formats allows you to
retain flexibility in how you validate data. The value of `'check'` can be a specific
validation handler name or `'any'` which should pass if any validation handler matches.

@param mixed  $name The name of the validation rule (string), or an array of key/value pairs
of names and rules.
@param string $rule If $name is a string, this should be a string regular expression, or a
closure that returns a boolean indicating success. Should be left blank if
`$name` is an array.
Sets or replaces one or several built - in validation rules .