/** * {@inheritdoc} */ public function process($elongate = false) { $return = array(); $return['name'] = $this->tag->getName(); $content = $this->clean($this->tag->getContent()); if (preg_match('/(<([^>]*)>)?\\s*([^\\s]*)\\s*(.*)?/', $content, $m)) { if (!empty($m[2])) { $return['type'] = $elongate ? AncestryHandler::elongateType($m[2], $this->ancestry) : $m[2]; } if (!empty($m[3])) { $return['dispatches'] = $m[3]; } if (!empty($m[4])) { $return['description'] = $m[4]; } } return $return; }
/** * {@inheritdoc} */ public function process($elongate = false) { $return = array(); $return['name'] = $this->tag->getName(); $content = $this->clean($this->tag->getContent()); $content = explode(' ', $content); $type = array_shift($content); $description = trim(implode(' ', $content)); if (strpos($type, '|')) { $self = $this; $return['type'] = 'mixed'; $return['types'] = explode('|', $type); $return['types'] = array_map(function ($type) use($self, $elongate) { return $elongate ? AncestryHandler::elongateType($type, $self->ancestry) : $type; }, $return['types']); } else { $return['type'] = $elongate ? AncestryHandler::elongateType($type, $this->ancestry) : $type; } if ($description) { $return['description'] = $description; } return $return; }
/** * Handle the arguments for the tag. * * @param string $arguments The raw arguments that have been parsed from the tag. * @param boolean $elongate Whether or not to elongate/resolve classes and aliases. * @return array An array containing a `type` and `types` key that should be merged back into the * parent node. */ public function handleArguments($arguments, $elongate) { $return = array(); $return['arguments'] = array(); $arguments = trim($arguments); if ($arguments) { foreach (explode(',', $arguments) as $argument) { preg_match('/^((\\w*)[\\s]*)?(&)?\\$(\\w*)([\\s]*=[\\s]*(.*))?$/', trim($argument), $matches); @(list(, , $type, $pbr, $name, , $default) = $matches); $pieces = array('name' => $name, 'type' => $type, 'required' => !$default, 'passed_by_reference' => (bool) $pbr); if ($type && strpos($type, '|')) { $self = $this; $pieces['type'] = 'mixed'; $pieces['types'] = explode('|', $type); $pieces['types'] = array_map(function ($type) use($self, $elongate) { return $elongate ? AncestryHandler::elongateType($type, $self->ancestry) : $type; }, $pieces['types']); } elseif ($type) { $pieces['type'] = $elongate ? AncestryHandler::elongateType($type, $this->ancestry) : $type; } $return['arguments'][] = $pieces; } } return $return; }