Applied fixes from StyleCI

This commit is contained in:
onigoetz 2016-07-28 16:48:50 -04:00 committed by Stéphane Goetz
parent 18e10cacc8
commit f7b47a6c19
6 changed files with 25 additions and 17 deletions

View File

@ -75,6 +75,6 @@ if (php_sapi_name() === 'cli-server') {
$_SERVER['SCRIPT_NAME'] = '/index.php'; $_SERVER['SCRIPT_NAME'] = '/index.php';
} }
require_once(__DIR__ . '/libs/bootstrap.php'); require_once __DIR__ . '/libs/bootstrap.php';
\Todaymade\Daux\Server\Server::serve(); \Todaymade\Daux\Server\Server::serve();

View File

@ -58,27 +58,33 @@ class Config extends ArrayObject
$this['current_page'] = $entry; $this['current_page'] = $entry;
} }
public function getDocumentationDirectory() { public function getDocumentationDirectory()
{
return $this['docs_directory']; return $this['docs_directory'];
} }
public function setDocumentationDirectory($documentationPath) { public function setDocumentationDirectory($documentationPath)
{
$this['docs_directory'] = $documentationPath; $this['docs_directory'] = $documentationPath;
} }
public function getThemesDirectory() { public function getThemesDirectory()
{
return $this['themes_directory']; return $this['themes_directory'];
} }
public function setFormat($format) { public function setFormat($format)
{
$this['format'] = $format; $this['format'] = $format;
} }
public function getFormat() { public function getFormat()
{
return $this['format']; return $this['format'];
} }
public function isMultilanguage() { public function isMultilanguage()
{
return array_key_exists('languages', $this) && !empty($this['languages']); return array_key_exists('languages', $this) && !empty($this['languages']);
} }
} }

View File

@ -1,7 +1,6 @@
<?php namespace Todaymade\Daux\Console; <?php namespace Todaymade\Daux\Console;
use Symfony\Component\Console\Command\Command as SymfonyCommand; use Symfony\Component\Console\Command\Command as SymfonyCommand;
use Symfony\Component\Console\Exception\InvalidOptionException;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
@ -34,8 +33,7 @@ class Generate extends SymfonyCommand
// HTML Format only // HTML Format only
->addOption('destination', 'd', InputOption::VALUE_REQUIRED, $description, 'static') ->addOption('destination', 'd', InputOption::VALUE_REQUIRED, $description, 'static')
->addOption('search', null, InputOption::VALUE_NONE, 'Generate full text search') ->addOption('search', null, InputOption::VALUE_NONE, 'Generate full text search');
;
} }
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
@ -44,6 +42,7 @@ class Generate extends SymfonyCommand
if ($input->getOption('serve')) { if ($input->getOption('serve')) {
$this->serve($daux, $input); $this->serve($daux, $input);
return; return;
} }

View File

@ -92,7 +92,8 @@ class Daux
} }
} }
public function normalizeThemePath($path) { public function normalizeThemePath($path)
{
if (is_dir($path)) { if (is_dir($path)) {
return $path; return $path;
} }

View File

@ -66,10 +66,11 @@ class Server
echo $page->getContent(); echo $page->getContent();
} }
public static function runServer(Config $config, $host, $port) { public static function runServer(Config $config, $host, $port)
{
chdir(__DIR__ . '/../../'); chdir(__DIR__ . '/../../');
putenv("DAUX_SOURCE=" . $config->getDocumentationDirectory()); putenv('DAUX_SOURCE=' . $config->getDocumentationDirectory());
$base = ProcessUtils::escapeArgument(__DIR__ . '/../../'); $base = ProcessUtils::escapeArgument(__DIR__ . '/../../');
$binary = ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false)); $binary = ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false));

View File

@ -2,18 +2,19 @@
// Loaded in the project itself // Loaded in the project itself
if (file_exists(__DIR__ . '/../vendor/autoload.php')) { if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
return require_once(__DIR__ . '/../vendor/autoload.php'); return require_once __DIR__ . '/../vendor/autoload.php';
} }
// Loaded as a dependency // Loaded as a dependency
if (file_exists(__DIR__ . '/../../../../autoload.php')) { if (file_exists(__DIR__ . '/../../../../autoload.php')) {
return require_once(__DIR__ . '/../../../../autoload.php'); return require_once __DIR__ . '/../../../../autoload.php';
} }
// Loaded in the project itself, when vendor isn't installed // Loaded in the project itself, when vendor isn't installed
if (file_exists(__DIR__ . '/../daux.phar')) { if (file_exists(__DIR__ . '/../daux.phar')) {
define('PHAR_DIR', __DIR__ . '/..'); define('PHAR_DIR', __DIR__ . '/..');
return require_once("phar://" . __DIR__ . "/../daux.phar/vendor/autoload.php");
return require_once 'phar://' . __DIR__ . '/../daux.phar/vendor/autoload.php';
} }
throw new Exception("Impossible to load Daux, missing vendor/ or daux.phar"); throw new Exception('Impossible to load Daux, missing vendor/ or daux.phar');