Ejemplo n.º 1
0
 /**
  * @param string $pattern
  * @param null   $errorPhrase
  *
  * @throws ArgumentTypeException
  */
 public function __construct($pattern, $errorPhrase = null)
 {
     if (!is_string($pattern)) {
         throw new ArgumentTypeException('pattern', 'string');
     }
     $this->pattern = $pattern;
     parent::__construct($errorPhrase);
 }
Ejemplo n.º 2
0
 /**
  * @param string $pattern
  * @param null   $errorPhrase
  *
  * @throws ConfigurationException
  */
 public function __construct($pattern, $errorPhrase = null)
 {
     if (!is_string($pattern)) {
         throw new ConfigurationException('Pattern should be a string');
     }
     $this->pattern = $pattern;
     parent::__construct($errorPhrase);
 }
Ejemplo n.º 3
0
 /**
  * @param int|null  $min
  * @param int|null  $max
  * @param array $errorPhrase
  *
  * @throws ArgumentTypeException
  */
 public function __construct($min = 1, $max = null, $errorPhrase = array('MIN' => null, 'MAX' => null))
 {
     if ($min !== null) {
         if (!is_int($min)) {
             throw new ArgumentTypeException('min', 'integer');
         }
         $this->min = $min;
     }
     if ($max !== null) {
         if (!is_int($max)) {
             throw new ArgumentTypeException('max', 'integer');
         }
         $this->max = $max;
     }
     if (!empty($errorPhrase['MIN'])) {
         $this->errorPhraseMin = $errorPhrase['MIN'];
     }
     if (!empty($errorPhrase['MAX'])) {
         $this->errorPhraseMax = $errorPhrase['MAX'];
     }
     parent::__construct();
 }
Ejemplo n.º 4
0
 /**
  * @param int   $min
  * @param null  $max
  * @param bool  $equality  Check "or equal" to the edges of the range
  * @param array $errorPhrase
  *
  * @throws ArgumentTypeException
  */
 public function __construct($min = 0, $max = null, $equality = false, $errorPhrase = array('MIN' => null, 'MAX' => null))
 {
     if ($min !== null) {
         if (!is_numeric($min)) {
             throw new ArgumentTypeException('min', 'numeric');
         }
         $this->min = $min;
     }
     if ($max !== null) {
         if (!is_numeric($max)) {
             throw new ArgumentTypeException('max', 'numeric');
         }
         $this->max = $max;
     }
     $this->equality = (bool) $equality;
     if (!empty($errorPhrase['MIN'])) {
         $this->errorPhraseMin = $errorPhrase['MIN'];
     }
     if (!empty($errorPhrase['MAX'])) {
         $this->errorPhraseMax = $errorPhrase['MAX'];
     }
     parent::__construct();
 }
Ejemplo n.º 5
0
 /**
  * @param Entity\Field $reference
  * @param array $filter
  */
 public function __construct(Entity\Field $reference, array $filter = array())
 {
     $this->reference = $reference;
     $this->filter = $filter;
     parent::__construct();
 }