protected function generateClassTreeLevel(Project $project, $level, array $namespaces, array $classes) { ++$level; $tree = array(); foreach ($namespaces as $namespace => $subnamespaces) { // classes if ($project->getConfig('simulate_namespaces')) { $cl = $project->getSimulatedNamespaceAllClasses($namespace); } else { $cl = $project->getNamespaceAllClasses($namespace); } // subnamespaces $ns = array(); foreach ($subnamespaces as $subnamespace) { $parts = explode('\\', $subnamespace); if (!isset($parts[$level - 1])) { continue; } $ns[implode('\\', array_slice($parts, 0, $level))][] = $subnamespace; } $parts = explode('\\', $namespace); $url = ''; if (!$project->getConfig('simulate_namespaces')) { $url = $parts[count($parts) - 1] && count($cl) ? $namespace : ''; } $short = $parts[count($parts) - 1] ? $parts[count($parts) - 1] : '[Global Namespace]'; $tree[] = array($short, $url, $this->generateClassTreeLevel($project, $level, $ns, $cl)); } foreach ($classes as $class) { if ($project->getConfig('simulate_namespaces')) { $parts = explode('_', $class->getShortName()); $short = array_pop($parts); } else { $short = $class->getShortName(); } $tree[] = array($short, $class, array()); } return $tree; }
public function __construct(Project $project = null) { $this->classes = array(); if (null !== $project) { foreach ($project->getProjectClasses() as $class) { $this->classes[$class->getName()] = $class->getHash(); } } $this->versions = array(); if (null !== $project) { foreach ($project->getVersions() as $version) { $this->versions[] = (string) $version; } } $this->namespaces = array(); if (null !== $project) { $this->namespaces = $project->getConfig('simulate_namespaces') ? $project->getSimulatedNamespaces() : $project->getNamespaces(); } }
protected function getTheme(Project $project) { return $this->themes->getTheme($project->getConfig('theme')); }
protected function renderClassTemplates(array $classes, Project $project, $callback = null) { foreach ($classes as $class) { if (null !== $callback) { call_user_func($callback, Message::RENDER_PROGRESS, array('Class', $class->getName(), $this->getProgression())); } $variables = array('class' => $class, 'properties' => $class->getProperties($project->getConfig('include_parent_data')), 'methods' => $class->getMethods($project->getConfig('include_parent_data')), 'constants' => $class->getConstants($project->getConfig('include_parent_data'))); foreach ($this->theme->getTemplates('class') as $template => $target) { $this->save($project, sprintf($target, str_replace('\\', '/', $class->getName())), $template, $variables); } } }