示例#1
0
 /**
  * @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);
 }
示例#2
0
 /**
  * @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);
 }
示例#3
0
 /**
  * @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);
 }