/** * Assign a value to a property of the PartBlock. This is an internal * helper method. This method will throw an InputTypeCheckException if * the assigned value does not match the expected value of a template. * * @param string $property input name * @param varies $value The value to be assigned. */ protected function assign($property, $value) { $inputs = Part::getInputs($this->partPath); if (isset($inputs[$property])) { if (Part::typeCheck($value, $inputs[$property]['type'])) { $this->args[$property] = $value; } else { $expected = $inputs[$property]['type']; $passed = gettype($value); if ($passed === 'object') { $passed = get_class($value); } throw new InputTypeCheckException("Part input type mismatch '{$property}' expects '{$expected}' passed '{$passed}'."); } } else { throw new InputDoesNotExistException("Part '{$this->partPath}' does not have a '{$property}' input.", 2); } }