Пример #1
0
 public function __construct(array $options = [])
 {
     parent::__construct($options);
     $options = $this->getOptions();
     if (!is_bool($options['trim'])) {
         throw new \Gajus\Vlad\Exception\InvalidArgumentException('Boolean property assigned non-boolean value.');
     }
 }
Пример #2
0
 public function __construct(array $options = [])
 {
     parent::__construct($options);
     $options = $this->getOptions();
     if (!isset($options['format'])) {
         throw new \Gajus\Vlad\Exception\InvalidArgumentException('"format" property is required.');
     }
 }
Пример #3
0
 public function __construct(array $options = [])
 {
     parent::__construct($options);
     $options = $this->getOptions();
     if (!isset($options['length'])) {
         throw new \Gajus\Vlad\Exception\InvalidArgumentException('"length" option is required.');
     }
     if (!ctype_digit((string) $options['length'])) {
         throw new \Gajus\Vlad\Exception\InvalidArgumentException('"length" option must be a whole number.');
     }
 }
Пример #4
0
 public function __construct(array $options = [])
 {
     parent::__construct($options);
     $options = $this->getOptions();
     if (!isset($options['range'])) {
         throw new \Gajus\Vlad\Exception\InvalidArgumentException('"range" option is required.');
     }
     if (!is_numeric($options['range'])) {
         throw new \Gajus\Vlad\Exception\InvalidArgumentException('Minimum boundary option must be numeric.');
     }
 }
Пример #5
0
 public function __construct(array $options = [])
 {
     parent::__construct($options);
     $options = $this->getOptions();
     if (!isset($options['pattern'])) {
         throw new \Gajus\Vlad\Exception\InvalidArgumentException('"pattern" property is required.');
     }
     if (@preg_match($options['pattern'], 'test') === false) {
         throw new \Gajus\Vlad\Exception\InvalidArgumentException('Pattern "' . $options['pattern'] . '" failed (' . array_flip(get_defined_constants(true)['pcre'])[preg_last_error()] . ').');
     }
 }
Пример #6
0
Файл: In.php Проект: gajus/vlad
 public function __construct(array $options = [])
 {
     parent::__construct($options);
     $options = $this->getOptions();
     if (!isset($options['haystack'])) {
         throw new \Gajus\Vlad\Exception\InvalidArgumentException('"haystack" option is missing.');
     } else {
         if (!is_array($options['haystack'])) {
             throw new \Gajus\Vlad\Exception\InvalidArgumentException('"haystack" option must be an array.');
         }
     }
     if (!is_bool($options['strict']) || !is_bool($options['c14n'])) {
         throw new \Gajus\Vlad\Exception\InvalidArgumentException('Boolean property assigned non-boolean value.');
     }
 }