Пример #1
0
 protected function renderGlobalTemplates(Project $project, $callback = null)
 {
     $variables = array('namespaces' => $project->getNamespaces(), 'interfaces' => $project->getProjectInterfaces(), 'classes' => $project->getProjectClasses(), 'items' => $this->getIndex($project), 'index' => $project->getIndex(), 'tree' => $project->getTree());
     foreach ($this->theme->getTemplates('global') as $template => $target) {
         if (null !== $callback) {
             call_user_func($callback, Message::RENDER_PROGRESS, array('Global', $target, $this->getProgression()));
         }
         $this->save($project, $target, $template, $variables);
     }
 }
Пример #2
0
 public function getTree(Project $project)
 {
     $namespaces = array();
     $ns = $project->getConfig('simulate_namespaces') ? $project->getSimulatedNamespaces() : $project->getNamespaces();
     foreach ($ns as $namespace) {
         if (false !== ($pos = strpos($namespace, '\\'))) {
             $namespaces[substr($namespace, 0, strpos($namespace, '\\'))][] = $namespace;
         } else {
             $namespaces[$namespace][] = $namespace;
         }
     }
     return $this->generateClassTreeLevel($project, 1, $namespaces, array());
 }
Пример #3
0
 public function getIndex(Project $project)
 {
     $index = array('searchIndex' => array(), 'info' => array());
     foreach ($project->getNamespaces() as $namespace) {
         $index['searchIndex'][] = $this->getSearchString($namespace);
         $index['info'][] = array(self::TYPE_NAMESPACE, $namespace);
     }
     foreach ($project->getProjectClasses() as $class) {
         $index['searchIndex'][] = $this->getSearchString((string) $class);
         $index['info'][] = array(self::TYPE_CLASS, $class);
     }
     foreach ($project->getProjectClasses() as $class) {
         foreach ($class->getMethods() as $method) {
             $index['searchIndex'][] = $this->getSearchString((string) $method);
             $index['info'][] = array(self::TYPE_METHOD, $method);
         }
     }
     return $index;
 }
Пример #4
0
 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();
     }
 }
Пример #5
0
 /**
  * Get all namespaces in the project.
  *
  * @return array
  */
 public function getNamespaces()
 {
     $this->parse();
     return $this->project->getNamespaces();
 }