function nsTree(ThemeResource $resource, $namespace, $actual = null, $origin = null) { echo '<ul class="cpnlist">'; foreach ($resource->getProject()->getNamespaceNamespaces($namespace) as $ns) { echo '<li class="ns">'; $nsName = array_pop(explode('\\', $ns)); echo '<a href="' . $resource->url($ns, "namespace", $origin) . '.html">' . $nsName . '</a>'; nsTree($resource, $ns, $actual, $origin); echo '</li>'; } foreach ($resource->getProject()->getNamespaceClasses($namespace) as $class) { echo '<li class="' . ($class->isInterface() ? "interface" : "class") . '"><a href="' . $resource->url($class->getName(), "class", $origin) . '.html">' . $class->getShortName() . '</a></li>'; } echo '</ul>'; }
/** * @param ThemeResource $resource * * @return string */ public function generate(ThemeResource $resource) { if ($resource->isType(\Documentor\ThemeResource::TYPE_CLASS)) { $file = 'class.phtml'; } elseif ($resource->isType(\Documentor\ThemeResource::TYPE_NAMESPACE)) { $file = 'namespace.phtml'; } elseif ($resource->isType(\Documentor\ThemeResource::TYPE_INDEX)) { $file = 'docindex.phtml'; } else { throw new \Documentor\Exception(sprintf('Invalid Theme Resource Type: %s', $resource->getType())); } $fullfile = rtrim($this->resourcesDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $file; if (!is_file($fullfile)) { throw new \Documentor\Exception(sprintf('Invalid Theme Resource File: %s', $fullfile)); } ob_start(); include $fullfile; $contents = ob_get_clean(); return $contents; }
function typeLink(ThemeResource $resource, ReturnTag $returnTag, $origin = null) { $types = $returnTag->getTypes(); $ret = array(); foreach ($types as $typeName) { if (isInternalType($typeName)) { $infos = getInternalTypeInfos($typeName); } else { $className = $resource->getResolver()->resolveClassName($typeName); if ($resource->getResolver()->isIndexed($className)) { $infos = array('name' => $className, 'link' => $resource->url($className, 'class', $origin) . '.md'); } else { $infos = array('name' => $typeName, 'link' => null); } } if ($infos['link'] != null && !empty($infos['link'])) { array_push($ret, sprintf("[%s](%s)", $infos['name'], $infos['link'])); } else { array_push($ret, $infos['name']); } } return implode('|', $ret); }
public function documentationIndex(Project $project) { return $this->getType()->generate(ThemeResource::factory()->setProject($project)->setType(ThemeResource::TYPE_INDEX)); }