Пример #1
0
 static function international_phone(&$value)
 {
     Filter::digits($value, 'digits');
     self::filled($value);
     if (strlen($value) < 11) {
         Debug::toss(['type' => 'phone_international'], 'InputException');
     }
     if (strlen($value) > 14) {
         Debug::toss(['type' => 'phone_international__over'], 'InputException');
     }
 }
Пример #2
0
    ///unsets given keyed field if value is missing
    function unsetOnMissing($value, $key = '')
    {
        if ($value === null || $value === '') {
            $key = $key ? $key : $this->input->currentField;
            unset($this->input->in[$key]);
        }
    }
    ///removes a field
    function remove(&$value)
    {
        $value = null;
        unset($this->input->in[$this->input->currentField]);
    }
    ///blanks a field
    function blank(&$value)
    {
        $value = '';
    }
    ///turns the fields into strings
    function toStrings()
    {
        foreach ($this->input->in as $k => &$v) {
            if (is_array($v)) {
                self::makeString($v);
            }
        }
    }
}
Filter::configure();