/** * Constructor. * * @param \Wingu\OctopusCore\Reflection\Annotation\AnnotationDefinition $definition The annotation definition. * @throws \Wingu\OctopusCore\Reflection\Annotation\Exceptions\InvalidArgumentException If the definition is not valid. */ public function __construct(AnnotationDefinition $definition) { if ($definition->getTag() !== 'var') { throw new InvalidArgumentException('The definition tag must be "var".'); } parent::__construct($definition); }
/** * Initialize the annotation tag. */ protected function initTag() { parent::initTag(); $value = preg_split('/[\\s]+/', $this->description, 2); if (isset($value[0]) === true && trim($value[0]) !== '') { $this->returnType = $value[0]; } if (isset($value[1]) === true && trim($value[1]) !== '') { $this->returnDescription = trim($value[1]); } }
/** * Initialize the annotation tag. */ protected function initTag() { parent::initTag(); $value = preg_split('/[\\s]+/', $this->description, 3); if (isset($value[0]) === true && trim($value[0]) !== '') { $this->paramType = trim($value[0]); } if (isset($value[1]) === true && trim($value[1]) !== '') { $this->paramName = trim($value[1]); if (strpos($this->paramName, '$') !== 0) { throw new RuntimeException('The name of the parameter does not start with "$".'); } } if (isset($value[2]) === true && trim($value[2]) !== '') { $this->paramDescription = trim($value[2]); } }