Пример #1
0
 public function output($depth)
 {
     $document = new Document();
     $target = $this->getOption('target');
     $link = $this->getOption('link') ?: $target;
     $link_text = $this->getOption('link-text') ?: "See: {$link}";
     $pre_link_text = $this->getOption('link-pre-text') ?: '';
     $post_link_text = $this->getOption('link-post-text') ?: '';
     if (is_file($target) && !is_writable($target) || !$this->recursiveTouch($target)) {
         throw new TargetNotWritableException($target . ' not writable');
     }
     //		$output = '';
     foreach ($this->getChildren() as $child) {
         $document->appendChild($child->output(0));
     }
     file_put_contents($target, $document->exportMarkdown());
     return "{$pre_link_text}[{$link_text}]({$link}){$post_link_text}\n\n";
 }
Пример #2
0
 public function output($depth)
 {
     $document = new Document();
     $name = $this->getOption('name');
     foreach ($this->getFileList($name) as $file) {
         if ($fileFilter = $this->getOption('file-filter')) {
             if (!preg_match($fileFilter, (string) $file)) {
                 continue;
             }
         }
         $class = new ClassFile(array('name' => (string) $file), $this->treeOptions);
         $this->addChild($class);
     }
     foreach ($this->getChildren() as $child) {
         if ($child instanceof AutoloaderAware) {
             $child->setAutoloader($this->autoloader);
         }
         $document->appendChild($child->output($depth));
     }
     return $document;
 }