Example #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;
 }
Example #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;
 }
Example #3
0
 /**
  * Constructs a new test case.
  * 
  * @param boolean $isExample whether this test case is an example
  * @param array $inputs the inputs for this test case
  * @param mixed $expectedOutput the expected output
  * @param string $explanation optional explanation of the expected output
  */
 public function __construct($isExample, $inputs, $expectedOutput, $explanation = '')
 {
     parent::__construct('test case');
     Validator::validateBoolean($isExample, 'is example');
     Validator::validateArray($inputs, 'inputs');
     Validator::validateNotNull($expectedOutput, 'expected output');
     Validator::validateString($explanation, 'explanation', true);
     $this->isExample = $isExample;
     $this->inputs = $inputs;
     $this->expectedOutput = $expectedOutput;
     $this->explanation = $explanation;
 }