JBZoo\SimpleTypes\Formatter::addRule PHP Method

addRule() public method

public addRule ( string $rule, array $newFormat = [] )
$rule string
$newFormat array
    public function addRule($rule, array $newFormat = array())
    {
        if (!$rule) {
            throw new Exception('Empty rule name');
        }
        if (array_key_exists($rule, $this->_rules)) {
            throw new Exception('Format "' . $rule . '" already exists');
        }
        $this->_rules[$rule] = array_merge($this->_default, (array) $newFormat);
    }