From f7b47a6c19fefbb3e695f2ee7b5fd5e78098fec7 Mon Sep 17 00:00:00 2001 From: onigoetz Date: Thu, 28 Jul 2016 16:48:50 -0400 Subject: [PATCH] Applied fixes from StyleCI --- index.php | 2 +- libs/Config.php | 18 ++++++++++++------ libs/Console/Generate.php | 5 ++--- libs/Daux.php | 3 ++- libs/Server/Server.php | 5 +++-- libs/bootstrap.php | 9 +++++---- 6 files changed, 25 insertions(+), 17 deletions(-) diff --git a/index.php b/index.php index a9d7c7f..653f922 100644 --- a/index.php +++ b/index.php @@ -75,6 +75,6 @@ if (php_sapi_name() === 'cli-server') { $_SERVER['SCRIPT_NAME'] = '/index.php'; } -require_once(__DIR__ . '/libs/bootstrap.php'); +require_once __DIR__ . '/libs/bootstrap.php'; \Todaymade\Daux\Server\Server::serve(); diff --git a/libs/Config.php b/libs/Config.php index 7e4a6ea..57a50b1 100644 --- a/libs/Config.php +++ b/libs/Config.php @@ -58,27 +58,33 @@ class Config extends ArrayObject $this['current_page'] = $entry; } - public function getDocumentationDirectory() { + public function getDocumentationDirectory() + { return $this['docs_directory']; } - public function setDocumentationDirectory($documentationPath) { + public function setDocumentationDirectory($documentationPath) + { $this['docs_directory'] = $documentationPath; } - public function getThemesDirectory() { + public function getThemesDirectory() + { return $this['themes_directory']; } - public function setFormat($format) { + public function setFormat($format) + { $this['format'] = $format; } - public function getFormat() { + public function getFormat() + { return $this['format']; } - public function isMultilanguage() { + public function isMultilanguage() + { return array_key_exists('languages', $this) && !empty($this['languages']); } } diff --git a/libs/Console/Generate.php b/libs/Console/Generate.php index a7313b4..6e91bad 100755 --- a/libs/Console/Generate.php +++ b/libs/Console/Generate.php @@ -1,7 +1,6 @@ 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) @@ -44,6 +42,7 @@ class Generate extends SymfonyCommand if ($input->getOption('serve')) { $this->serve($daux, $input); + return; } diff --git a/libs/Daux.php b/libs/Daux.php index 2878bee..b83bfbb 100644 --- a/libs/Daux.php +++ b/libs/Daux.php @@ -92,7 +92,8 @@ class Daux } } - public function normalizeThemePath($path) { + public function normalizeThemePath($path) + { if (is_dir($path)) { return $path; } diff --git a/libs/Server/Server.php b/libs/Server/Server.php index aa4cd49..664ee2b 100755 --- a/libs/Server/Server.php +++ b/libs/Server/Server.php @@ -66,10 +66,11 @@ class Server echo $page->getContent(); } - public static function runServer(Config $config, $host, $port) { + public static function runServer(Config $config, $host, $port) + { chdir(__DIR__ . '/../../'); - putenv("DAUX_SOURCE=" . $config->getDocumentationDirectory()); + putenv('DAUX_SOURCE=' . $config->getDocumentationDirectory()); $base = ProcessUtils::escapeArgument(__DIR__ . '/../../'); $binary = ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false)); diff --git a/libs/bootstrap.php b/libs/bootstrap.php index 1d2dd4a..2b85e64 100644 --- a/libs/bootstrap.php +++ b/libs/bootstrap.php @@ -2,18 +2,19 @@ // Loaded in the project itself 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 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 if (file_exists(__DIR__ . '/../daux.phar')) { 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');