Esempio n. 1
0
 public function buildJsonClassDefinition($classList, NamespaceAccessor $nsA)
 {
     $output = array("allClasses" => array(), "allNamespaces" => array(), "classes" => array(), "namespaces" => array());
     foreach ($classList as $class) {
         $cDef = $class->getClassDefinition();
         $cName = $cDef->getCompleteName();
         $output["allClasses"][$cName] = array("type" => $cDef->getType(), "name" => $cName, "shortname" => $cDef->getName());
         if (!strpos($cName, "\\") > 0) {
             $output["classes"][] = $cName;
         }
     }
     $tree = $nsA->getNamespaceTree();
     $namespaces = $nsA->getByNamespace();
     foreach ($namespaces as $ns) {
         $subclasses = array();
         $subnamespaces = array();
         foreach ($ns->getClasses() as $scs) {
             $subclasses[] = $scs->getClassDefinition()->getCompleteName();
         }
         foreach ($ns->getNamespaces() as $sns) {
             $subnamespaces[] = $sns->getFullNamespace();
         }
         $output["allNamespaces"][$ns->getFullNamespace()] = array("name" => $ns->getFullNamespace(), "shortName" => $ns->getShortName(), "parentName" => $ns->getParentName(), "classes" => $subclasses, "namespaces" => $subnamespaces);
         if (!strpos($ns->getFullNamespace(), "\\") > 0) {
             $output["namespaces"][] = $ns->getFullNamespace();
         }
     }
     return json_encode($output);
 }
Esempio n. 2
0
 public function build()
 {
     $byNamespace = array();
     foreach ($this->classes as $className => $class) {
         // class files (class/ns1/n2/class.html)
         $cfile = new File\ClassFile($this->config, $class);
         $this->theme->drawFile($cfile);
         // class source file (source/ns1/n2/class.html)
         $sfile = new File\SourceFile($this->config, $class);
         $this->theme->drawFile($sfile);
     }
     // classes file (classes.html)
     $file = new File\ClassesFile($this->config, $this->classes);
     $this->theme->drawFile($file);
     $namespaceAccessor = new NamespaceAccessor($this->classes);
     $namespaceAccessor->build();
     $byNamespace = $namespaceAccessor->getByNamespace();
     foreach ($byNamespace as $namespaceName => $nh) {
         // namespace files (namespace/ns1/n2/namespace.html)
         $nfile = new File\NamespaceFile($this->config, $nh);
         $this->theme->drawFile($nfile);
     }
     if ($this->baseUrl) {
         $sitemapFile = new File\Sitemap($this->baseUrl, $this->classes, $byNamespace);
         $this->theme->drawFile($sitemapFile);
     }
     // namespaces files (namespaces.html)
     $nsfile = new File\NamespacesFile($this->config, $namespaceAccessor);
     $this->theme->drawFile($nsfile);
     // index (index.html)
     $indexfile = new File\IndexFile($this->config, $namespaceAccessor);
     $this->theme->drawFile($indexfile);
     $this->theme->buildStaticDirectory();
     $JsonClassDef = $this->theme->buildJsonClassDefinition($this->classes, $namespaceAccessor);
     $this->theme->createFile("asset/api_definition.js", "var ZephirApi = {$JsonClassDef};");
 }
Esempio n. 3
0
 public function getData()
 {
     return array("namespaceAccessor" => $this->namespaceAccessor, "namespacesTree" => $this->namespaceAccessor->getNamespaceTree(), "namespaces" => $this->namespaceAccessor->getByNamespace());
 }