/** * @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); }
/** * @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); }
/** * @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(); }
/** * @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(); }
/** * @param Entity\Field $reference * @param array $filter */ public function __construct(Entity\Field $reference, array $filter = array()) { $this->reference = $reference; $this->filter = $filter; parent::__construct(); }