/** * @return bool */ private function isDirectUrl(ReflectionElement $element) { if ($element instanceof ReflectionClass || $element instanceof ReflectionFunction || $element instanceof ReflectionConstant && $element->getDeclaringClassName() === NULL) { return TRUE; } return FALSE; }
/** * @param ReflectionMethod|ReflectionProperty $reflection * @return string */ private function getPropertyOrMethodFqnName(ReflectionElement $reflection) { return $reflection->getDeclaringClassName() . '::' . $reflection->getName(); }
/** * @param ReflectionClass|ReflectionParameter|ReflectionFunction|ReflectionElement $reflectionElement * @return ReflectionClass|ReflectionFunction */ private function correctContextForParameterOrClassMember($reflectionElement) { if ($reflectionElement instanceof ReflectionParameter && $reflectionElement->getDeclaringClassName() === NULL) { // Parameter of function in namespace or global space return $this->getFunction($reflectionElement->getDeclaringFunctionName()); } elseif ($reflectionElement instanceof ReflectionMethod || $reflectionElement instanceof ReflectionParameter || $reflectionElement instanceof ReflectionConstant && $reflectionElement->getDeclaringClassName() !== NULL || $reflectionElement instanceof ReflectionProperty) { // Member of a class return $this->getClass($reflectionElement->getDeclaringClassName()); } return $reflectionElement; }
/** * Returns a link to a element source code. * * @param \ApiGen\Reflection\ReflectionElement $element Element reflection * @param boolean $withLine Include file line number into the link * @return string */ public function getSourceUrl(Reflection\ReflectionElement $element, $withLine = true) { if ($element instanceof Reflection\ReflectionClass || $element instanceof Reflection\ReflectionFunction || $element instanceof Reflection\ReflectionConstant && null === $element->getDeclaringClassName()) { $elementName = $element->getName(); if ($element instanceof Reflection\ReflectionClass) { $file = 'class-'; } elseif ($element instanceof Reflection\ReflectionConstant) { $file = 'constant-'; } elseif ($element instanceof Reflection\ReflectionFunction) { $file = 'function-'; } } else { $elementName = $element->getDeclaringClassName(); $file = 'class-'; } $file .= $this->urlize($elementName); $lines = null; if ($withLine) { $lines = $element->getStartLine() !== $element->getEndLine() ? sprintf('%s-%s', $element->getStartLine(), $element->getEndLine()) : $element->getStartLine(); } return sprintf($this->config->template->templates->main->source->filename, $file) . (null !== $lines ? '#' . $lines : ''); }