Пример #1
0
 /**
  * Constructs a new parameter based on the given information.
  * 
  * @param string $name the new parameter's name
  * @param string $type the new parameter's return type
  * @param array:string $constraints the new parameter's constraint(s)
  */
 public function __construct($name, $type, $constraints)
 {
     parent::__construct($name);
     Validator::validateString($type, 'type');
     Validator::validateStringArray($constraints, 'constraints');
     $this->name = $name;
     $this->type = $type;
     $this->constraints = $constraints;
 }
Пример #2
0
 /**
  * Constructs a new method based on the given information.
  * 
  * @param string $name the new method's name
  * @param string $returnType the new method's return type
  * @param array $parameters the new method's parameters
  * @param array $constraints the new method's constraint(s)
  */
 public function __construct($name, $returnType, $parameters, $constraints)
 {
     parent::__construct($name);
     Validator::validateString($returnType, 'return type');
     Validator::validateTypedArray($parameters, 'Shawware\\CodingChallenge\\Model\\Parameter', 'parameters');
     Validator::validateStringArray($constraints, 'constraints');
     $this->name = $name;
     $this->returnType = $returnType;
     $this->parameters = $parameters;
     $this->constraints = $constraints;
 }