/** * @param string $name * @param string $class * @param string $message */ public function __construct($name, $class, $message = ':name is invalid') { if (!class_exists($class) and !interface_exists($class)) { throw new InvalidArgumentException(sprintf('%s should be a valid class or interface', $class)); } $this->class = $class; parent::__construct($name, $message); }
/** * @param string $name * @param array $array * @param string $message */ public function __construct($name, array $array, $message = ':name is invalid') { if (empty($array)) { throw new InvalidArgumentException('Array should not be empty'); } $this->array = $array; parent::__construct($name, $message); }
/** * @param string $name * @param integer $type AssertRange::CONSECUTIVE or AssertRange::RANDOM * @param string $message */ public function __construct($name, $type = AssertRange::CONSECUTIVE, $message = ':name is invalid') { $this->type = $type; parent::__construct($name, $message); }