getParams() public method

public getParams ( ) : Config
return Config
Ejemplo n.º 1
0
 /**
  * Serve the documentation
  *
  * @throws Exception
  */
 public static function serve()
 {
     $daux = new Daux(Daux::LIVE_MODE);
     $daux->initializeConfiguration();
     $class = $daux->getProcessorClass();
     if (!empty($class)) {
         $daux->setProcessor(new $class($daux, new NullOutput(), 0));
     }
     // Set this critical configuration
     // for the tree generation
     $daux->getParams()['index_key'] = 'index';
     // Improve the tree with a processor
     $daux->generateTree();
     $server = new static($daux);
     try {
         $page = $server->handle($_REQUEST);
     } catch (NotFoundException $e) {
         http_response_code(404);
         $page = new ErrorPage('An error occured', $e->getMessage(), $daux->getParams());
     }
     if ($page instanceof RawPage) {
         header('Content-type: ' . MimeType::get($page->getFile()));
         // Transfer file in 1024 byte chunks to save memory usage.
         if ($fd = fopen($page->getFile(), 'rb')) {
             while (!feof($fd)) {
                 echo fread($fd, 1024);
             }
             fclose($fd);
         }
         return;
     }
     header('Content-type: text/html; charset=utf-8');
     echo $page->getContent();
 }
Ejemplo n.º 2
0
 public function generateAll(InputInterface $input, OutputInterface $output, $width)
 {
     $destination = $input->getOption('destination');
     $params = $this->daux->getParams();
     if (is_null($destination)) {
         $destination = $this->daux->local_base . DIRECTORY_SEPARATOR . 'static';
     }
     $this->runAction("Copying Static assets ...", $output, $width, function () use($destination) {
         GeneratorHelper::copyAssets($destination, $this->daux->local_base);
     });
     $output->writeLn("Generating ...");
     $this->generateRecursive($this->daux->tree, $destination, $params, $output, $width);
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function generateAll(InputInterface $input, OutputInterface $output, $width)
 {
     $params = $this->daux->getParams();
     $confluence = $params['confluence'];
     $this->prefix = trim($confluence['prefix']) . " ";
     $tree = $this->runAction("Generating Tree ...", $output, $width, function () use($params) {
         $tree = $this->generateRecursive($this->daux->tree, $params);
         $tree['title'] = $this->prefix . $params['title'];
         return $tree;
     });
     $output->writeln("Start Publishing...");
     $publisher = new Publisher($confluence);
     $publisher->output = $output;
     $publisher->width = $width;
     $publisher->publish($tree);
 }
Ejemplo n.º 4
0
 protected function prepareDaux(InputInterface $input)
 {
     $daux = new Daux(Daux::STATIC_MODE);
     // Set the format if requested
     if ($input->hasOption('format') && $input->getOption('format')) {
         $daux->getParams()->setFormat($input->getOption('format'));
     }
     // Set the source directory
     if ($input->getOption('source')) {
         $daux->getParams()->setDocumentationDirectory($input->getOption('source'));
     }
     $daux->initializeConfiguration($input->getOption('configuration'));
     if ($input->hasOption('delete') && $input->getOption('delete')) {
         $daux->getParams()['confluence']['delete'] = true;
     }
     return $daux;
 }
Ejemplo n.º 5
0
 /**
  * {@inheritdoc}
  */
 public function generateAll(InputInterface $input, OutputInterface $output, $width)
 {
     $params = $this->daux->getParams();
     $data = ['author' => $params['author'], 'title' => $params['title'], 'subject' => $params['tagline']];
     $book = new Book($this->daux->tree, $data);
     $current = $this->daux->tree->getIndexPage();
     while ($current) {
         $this->runAction('Generating ' . $current->getTitle(), $output, $width, function () use($book, $current, $params) {
             $contentType = $this->daux->getContentTypeHandler()->getType($current);
             $content = ContentPage::fromFile($current, $params, $contentType)->getContent();
             $book->addPage($current, $content);
         });
         $current = $current->getNext();
     }
     $content = $book->generate();
     file_put_contents($input->getOption('destination') . '/file.html', $content);
 }
Ejemplo n.º 6
0
 protected function prepareProcessor(Daux $daux, InputInterface $input, OutputInterface $output, $width)
 {
     if ($input->getOption('processor')) {
         $daux->getParams()['processor'] = $input->getOption('processor');
     }
     $class = $daux->getProcessorClass();
     if (!empty($class)) {
         $daux->setProcessor(new $class($daux, $output, $width));
     }
 }
Ejemplo n.º 7
0
 public function generateAll(InputInterface $input, OutputInterface $output, $width)
 {
     $destination = $input->getOption('destination');
     $params = $this->daux->getParams();
     if (is_null($destination)) {
         $destination = $this->daux->local_base . DIRECTORY_SEPARATOR . 'static';
     }
     $this->runAction('Copying Static assets ...', $output, $width, function () use($destination) {
         GeneratorHelper::copyAssets($destination, $this->daux->local_base);
     });
     $output->writeLn('Generating ...');
     if (!array_key_exists('search', $params['html']) || !$params['html']['search']) {
         $params['html']['search'] = $input->getOption('search');
     }
     $this->generateRecursive($this->daux->tree, $destination, $params, $output, $width, $params['html']['search']);
     if ($params['html']['search']) {
         GeneratorHelper::copyRecursive($this->daux->local_base . DIRECTORY_SEPARATOR . 'tipuesearch' . DIRECTORY_SEPARATOR, $destination . DIRECTORY_SEPARATOR . 'tipuesearch');
         file_put_contents($destination . DIRECTORY_SEPARATOR . 'tipuesearch' . DIRECTORY_SEPARATOR . 'tipuesearch_content.json', json_encode(['pages' => $this->indexed_pages]));
     }
 }