Ejemplo n.º 1
0
 public function __construct($themeDir, $outputDir, $themeConfig, $config, Documentation $documentation)
 {
     $this->outputDir = $outputDir;
     $this->themeConfig = $themeConfig;
     $this->themeDir = $themeDir;
     $this->options = $themeConfig["options"];
     $this->projectConfig = $config;
     $this->documentation = $documentation;
     $themeInfosPath = $this->getThemePath("theme.json");
     if ($themeInfosPath) {
         $themeInfos = json_decode(file_get_contents($themeInfosPath), true);
         if (!$themeInfos) {
             throw new Exception("Cant parse file {$themeInfosPath}");
         } else {
             $this->themeInfos = $themeInfos;
             if (isset($themeInfos["extends"])) {
                 $extThemePath = $documentation->findThemePathByName($themeInfos["extends"]);
                 if (!$extThemePath) {
                     throw new Exception("Unable to find extended theme " . $themeInfos["extends"]);
                 }
                 $this->extendedTheme = new Theme($extThemePath, $outputDir, $themeConfig, $config, $documentation);
             }
         }
     }
 }
Ejemplo n.º 2
0
 public function getOutputFile()
 {
     return \Zephir\Documentation::namespaceUrl($this->namespaceHelper->getFullNamespace());
 }
Ejemplo n.º 3
0
 /**
  * Generate a HTML API
  *
  * @param CommandInterface $command
  * @param bool             $fromGenerate
  */
 public function api(CommandInterface $command, $fromGenerate = false)
 {
     if (!$fromGenerate) {
         $this->generate($command);
     }
     $documentator = new Documentation($this->files, $this->config, $this->logger, $command);
     $this->logger->output('Generating API into ' . $documentator->getOutputDirectory());
     $documentator->build();
 }
Ejemplo n.º 4
0
 public function getOutputFile()
 {
     return \Zephir\Documentation::sourceUrl($this->class);
 }
Ejemplo n.º 5
0
 /**
  * Generate an url relative to the current directory
  *
  * @param string $url the url we want to reach
  * @return string the relative path to the url
  */
 public function url($url)
 {
     if (is_string($url)) {
         if ($url[0] == "/") {
             return $this->getPathToRoot() . ltrim($url, "/");
         } elseif (is_string($url)) {
             return $url;
         }
     } elseif ($url instanceof ClassDefinition) {
         return $this->url(Documentation::classUrl($url));
     } elseif ($url instanceof CompilerFile) {
         return $this->url(Documentation::classUrl($url->getClassDefinition()));
     }
     return "";
 }