@@ -145,6 +145,7 @@ discard block |
||
| 145 | 145 | /** |
| 146 | 146 | * Access a variable from the phpci.yml file. |
| 147 | 147 | * @param string |
| 148 | + * @param string $key |
|
| 148 | 149 | * @return mixed |
| 149 | 150 | */ |
| 150 | 151 | public function getConfig($key) |
@@ -160,7 +161,7 @@ discard block |
||
| 160 | 161 | |
| 161 | 162 | /** |
| 162 | 163 | * Access a variable from the config.yml |
| 163 | - * @param $key |
|
| 164 | + * @param string $key |
|
| 164 | 165 | * @return mixed |
| 165 | 166 | */ |
| 166 | 167 | public function getSystemConfig($key) |
@@ -357,6 +358,7 @@ discard block |
||
| 357 | 358 | /** |
| 358 | 359 | * Add a success-coloured message to the log. |
| 359 | 360 | * @param string |
| 361 | + * @param string $message |
|
| 360 | 362 | */ |
| 361 | 363 | public function logSuccess($message) |
| 362 | 364 | { |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * PHPCI - Continuous Integration for PHP |
|
| 4 | - * |
|
| 5 | - * @copyright Copyright 2014, Block 8 Limited. |
|
| 6 | - * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md |
|
| 7 | - * @link https://www.phptesting.org/ |
|
| 8 | - */ |
|
| 3 | + * PHPCI - Continuous Integration for PHP |
|
| 4 | + * |
|
| 5 | + * @copyright Copyright 2014, Block 8 Limited. |
|
| 6 | + * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md |
|
| 7 | + * @link https://www.phptesting.org/ |
|
| 8 | + */ |
|
| 9 | 9 | |
| 10 | 10 | namespace PHPCI; |
| 11 | 11 | |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | $this->buildLogger->log($message, $level, $context); |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | - /** |
|
| 357 | + /** |
|
| 358 | 358 | * Add a success-coloured message to the log. |
| 359 | 359 | * @param string |
| 360 | 360 | */ |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $this->buildLogger = new BuildLogger($logger, $build); |
| 111 | 111 | |
| 112 | 112 | $pluginFactory = $this->buildPluginFactory($build); |
| 113 | - $pluginFactory->addConfigFromFile(PHPCI_DIR . "/pluginconfig.php"); |
|
| 113 | + $pluginFactory->addConfigFromFile(PHPCI_DIR."/pluginconfig.php"); |
|
| 114 | 114 | $this->pluginExecutor = new Plugin\Util\Executor($pluginFactory, $this->buildLogger); |
| 115 | 115 | |
| 116 | 116 | $executorClass = 'PHPCI\Helper\UnixCommandExecutor'; |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | } |
| 236 | 236 | } catch (\Exception $ex) { |
| 237 | 237 | $this->build->setStatus(Build::STATUS_FAILED); |
| 238 | - $this->buildLogger->logFailure(Lang::get('exception') . $ex->getMessage()); |
|
| 238 | + $this->buildLogger->logFailure(Lang::get('exception').$ex->getMessage()); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | |
| 385 | 385 | $self = $this; |
| 386 | 386 | $pluginFactory->registerResource( |
| 387 | - function () use ($self) { |
|
| 387 | + function() use ($self) { |
|
| 388 | 388 | return $self; |
| 389 | 389 | }, |
| 390 | 390 | null, |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | ); |
| 393 | 393 | |
| 394 | 394 | $pluginFactory->registerResource( |
| 395 | - function () use ($build) { |
|
| 395 | + function() use ($build) { |
|
| 396 | 396 | return $build; |
| 397 | 397 | }, |
| 398 | 398 | null, |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | |
| 402 | 402 | $logger = $this->logger; |
| 403 | 403 | $pluginFactory->registerResource( |
| 404 | - function () use ($logger) { |
|
| 404 | + function() use ($logger) { |
|
| 405 | 405 | return $logger; |
| 406 | 406 | }, |
| 407 | 407 | null, |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | ); |
| 410 | 410 | |
| 411 | 411 | $pluginFactory->registerResource( |
| 412 | - function () use ($self) { |
|
| 412 | + function() use ($self) { |
|
| 413 | 413 | $factory = new MailerFactory($self->getSystemConfig('phpci')); |
| 414 | 414 | return $factory->getSwiftMailerFromConfig(); |
| 415 | 415 | }, |
@@ -11,7 +11,6 @@ |
||
| 11 | 11 | |
| 12 | 12 | use Exception; |
| 13 | 13 | use PDO; |
| 14 | - |
|
| 15 | 14 | use b8\Config; |
| 16 | 15 | use b8\Store\Factory; |
| 17 | 16 | use PHPCI\Helper\Lang; |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * PHPCI - Continuous Integration for PHP |
|
| 4 | - * |
|
| 5 | - * @copyright Copyright 2014, Block 8 Limited. |
|
| 6 | - * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md |
|
| 7 | - * @link https://www.phptesting.org/ |
|
| 8 | - */ |
|
| 3 | + * PHPCI - Continuous Integration for PHP |
|
| 4 | + * |
|
| 5 | + * @copyright Copyright 2014, Block 8 Limited. |
|
| 6 | + * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md |
|
| 7 | + * @link https://www.phptesting.org/ |
|
| 8 | + */ |
|
| 9 | 9 | |
| 10 | 10 | namespace PHPCI\Command; |
| 11 | 11 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | protected function configure() |
| 36 | 36 | { |
| 37 | - $defaultPath = PHPCI_DIR . 'PHPCI/config.yml'; |
|
| 37 | + $defaultPath = PHPCI_DIR.'PHPCI/config.yml'; |
|
| 38 | 38 | |
| 39 | 39 | $this |
| 40 | 40 | ->setName('phpci:install') |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | $dialog = $this->getHelperSet()->get('dialog'); |
| 175 | 175 | |
| 176 | 176 | // Function to validate mail address. |
| 177 | - $mailValidator = function ($answer) { |
|
| 177 | + $mailValidator = function($answer) { |
|
| 178 | 178 | if (!filter_var($answer, FILTER_VALIDATE_EMAIL)) { |
| 179 | 179 | throw new \InvalidArgumentException(Lang::get('must_be_valid_email')); |
| 180 | 180 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | $dialog = $this->getHelperSet()->get('dialog'); |
| 219 | 219 | |
| 220 | 220 | // FUnction do validate URL. |
| 221 | - $urlValidator = function ($answer) { |
|
| 221 | + $urlValidator = function($answer) { |
|
| 222 | 222 | if (!filter_var($answer, FILTER_VALIDATE_URL)) { |
| 223 | 223 | throw new Exception(Lang::get('must_be_valid_url')); |
| 224 | 224 | } |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | |
| 333 | 333 | } catch (Exception $ex) { |
| 334 | 334 | $output->writeln('<error>'.Lang::get('could_not_connect').'</error>'); |
| 335 | - $output->writeln('<error>' . $ex->getMessage() . '</error>'); |
|
| 335 | + $output->writeln('<error>'.$ex->getMessage().'</error>'); |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | return false; |
@@ -354,9 +354,9 @@ discard block |
||
| 354 | 354 | { |
| 355 | 355 | $output->write(Lang::get('setting_up_db')); |
| 356 | 356 | |
| 357 | - $phinxBinary = escapeshellarg(PHPCI_DIR . 'vendor/bin/phinx'); |
|
| 358 | - $phinxScript = escapeshellarg(PHPCI_DIR . 'phinx.php'); |
|
| 359 | - shell_exec($phinxBinary . ' migrate -c ' . $phinxScript); |
|
| 357 | + $phinxBinary = escapeshellarg(PHPCI_DIR.'vendor/bin/phinx'); |
|
| 358 | + $phinxScript = escapeshellarg(PHPCI_DIR.'phinx.php'); |
|
| 359 | + shell_exec($phinxBinary.' migrate -c '.$phinxScript); |
|
| 360 | 360 | |
| 361 | 361 | $output->writeln('<info>'.Lang::get('ok').'</info>'); |
| 362 | 362 | } |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | $output->writeln('<info>'.Lang::get('user_created').'</info>'); |
| 380 | 380 | } catch (\Exception $ex) { |
| 381 | 381 | $output->writeln('<error>'.Lang::get('failed_to_create').'</error>'); |
| 382 | - $output->writeln('<error>' . $ex->getMessage() . '</error>'); |
|
| 382 | + $output->writeln('<error>'.$ex->getMessage().'</error>'); |
|
| 383 | 383 | } |
| 384 | 384 | } |
| 385 | 385 | |
@@ -9,7 +9,6 @@ |
||
| 9 | 9 | |
| 10 | 10 | namespace PHPCI\Command; |
| 11 | 11 | |
| 12 | -use b8\Config; |
|
| 13 | 12 | use b8\Store\Factory; |
| 14 | 13 | use Monolog\Logger; |
| 15 | 14 | use PHPCI\BuildFactory; |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * PHPCI - Continuous Integration for PHP |
|
| 4 | - * |
|
| 5 | - * @copyright Copyright 2015, Block 8 Limited. |
|
| 6 | - * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md |
|
| 7 | - * @link https://www.phptesting.org/ |
|
| 8 | - */ |
|
| 3 | + * PHPCI - Continuous Integration for PHP |
|
| 4 | + * |
|
| 5 | + * @copyright Copyright 2015, Block 8 Limited. |
|
| 6 | + * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md |
|
| 7 | + * @link https://www.phptesting.org/ |
|
| 8 | + */ |
|
| 9 | 9 | |
| 10 | 10 | namespace PHPCI\Command; |
| 11 | 11 | |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | $build = array_shift($result['items']); |
| 79 | 79 | $build = BuildFactory::getBuild($build); |
| 80 | 80 | |
| 81 | - $this->logger->addInfo('Added build #' . $build->getId() . ' to queue.'); |
|
| 81 | + $this->logger->addInfo('Added build #'.$build->getId().' to queue.'); |
|
| 82 | 82 | $buildService->addBuildToQueue($build); |
| 83 | 83 | } |
| 84 | 84 | } |
@@ -135,11 +135,17 @@ |
||
| 135 | 135 | return $builds; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | + /** |
|
| 139 | + * @param integer $numBuilds |
|
| 140 | + */ |
|
| 138 | 141 | public function setMaxBuilds($numBuilds) |
| 139 | 142 | { |
| 140 | 143 | $this->maxBuilds = (int)$numBuilds; |
| 141 | 144 | } |
| 142 | 145 | |
| 146 | + /** |
|
| 147 | + * @param boolean $fromDaemon |
|
| 148 | + */ |
|
| 143 | 149 | public function setDaemon($fromDaemon) |
| 144 | 150 | { |
| 145 | 151 | $this->isFromDaemon = (bool)$fromDaemon; |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * PHPCI - Continuous Integration for PHP |
|
| 4 | - * |
|
| 5 | - * @copyright Copyright 2014, Block 8 Limited. |
|
| 6 | - * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md |
|
| 7 | - * @link https://www.phptesting.org/ |
|
| 8 | - */ |
|
| 3 | + * PHPCI - Continuous Integration for PHP |
|
| 4 | + * |
|
| 5 | + * @copyright Copyright 2014, Block 8 Limited. |
|
| 6 | + * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md |
|
| 7 | + * @link https://www.phptesting.org/ |
|
| 8 | + */ |
|
| 9 | 9 | |
| 10 | 10 | namespace PHPCI\Command; |
| 11 | 11 | |
@@ -124,7 +124,7 @@ |
||
| 124 | 124 | } catch (\Exception $ex) { |
| 125 | 125 | $build->setStatus(Build::STATUS_FAILED); |
| 126 | 126 | $build->setFinished(new \DateTime()); |
| 127 | - $build->setLog($build->getLog() . PHP_EOL . PHP_EOL . $ex->getMessage()); |
|
| 127 | + $build->setLog($build->getLog().PHP_EOL.PHP_EOL.$ex->getMessage()); |
|
| 128 | 128 | $store->save($build); |
| 129 | 129 | } |
| 130 | 130 | |
@@ -227,6 +227,7 @@ |
||
| 227 | 227 | |
| 228 | 228 | /** |
| 229 | 229 | * Parse log for unix colours and replace with HTML. |
| 230 | + * @param string $log |
|
| 230 | 231 | */ |
| 231 | 232 | protected function cleanLog($log) |
| 232 | 233 | { |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * PHPCI - Continuous Integration for PHP |
|
| 4 | - * |
|
| 5 | - * @copyright Copyright 2014, Block 8 Limited. |
|
| 6 | - * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md |
|
| 7 | - * @link https://www.phptesting.org/ |
|
| 8 | - */ |
|
| 3 | + * PHPCI - Continuous Integration for PHP |
|
| 4 | + * |
|
| 5 | + * @copyright Copyright 2014, Block 8 Limited. |
|
| 6 | + * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md |
|
| 7 | + * @link https://www.phptesting.org/ |
|
| 8 | + */ |
|
| 9 | 9 | |
| 10 | 10 | namespace PHPCI\Controller; |
| 11 | 11 | |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | - * View a specific build. |
|
| 51 | - */ |
|
| 50 | + * View a specific build. |
|
| 51 | + */ |
|
| 52 | 52 | public function view($buildId) |
| 53 | 53 | { |
| 54 | 54 | try { |
@@ -123,8 +123,8 @@ discard block |
||
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
| 126 | - * AJAX call to get build data: |
|
| 127 | - */ |
|
| 126 | + * AJAX call to get build data: |
|
| 127 | + */ |
|
| 128 | 128 | public function data($buildId) |
| 129 | 129 | { |
| 130 | 130 | $response = new JsonResponse(); |
@@ -160,8 +160,8 @@ discard block |
||
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
| 163 | - * Get build data from database and json encode it: |
|
| 164 | - */ |
|
| 163 | + * Get build data from database and json encode it: |
|
| 164 | + */ |
|
| 165 | 165 | protected function getBuildData(Build $build) |
| 166 | 166 | { |
| 167 | 167 | $data = array(); |
@@ -188,8 +188,8 @@ discard block |
||
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | /** |
| 191 | - * Create a build using an existing build as a template: |
|
| 192 | - */ |
|
| 191 | + * Create a build using an existing build as a template: |
|
| 192 | + */ |
|
| 193 | 193 | public function rebuild($buildId) |
| 194 | 194 | { |
| 195 | 195 | $copy = BuildFactory::getBuildById($buildId); |
@@ -206,8 +206,8 @@ discard block |
||
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | /** |
| 209 | - * Delete a build. |
|
| 210 | - */ |
|
| 209 | + * Delete a build. |
|
| 210 | + */ |
|
| 211 | 211 | public function delete($buildId) |
| 212 | 212 | { |
| 213 | 213 | $this->requireAdmin(); |
@@ -226,8 +226,8 @@ discard block |
||
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | /** |
| 229 | - * Parse log for unix colours and replace with HTML. |
|
| 230 | - */ |
|
| 229 | + * Parse log for unix colours and replace with HTML. |
|
| 230 | + */ |
|
| 231 | 231 | protected function cleanLog($log) |
| 232 | 232 | { |
| 233 | 233 | return AnsiConverter::convert($log); |
@@ -87,10 +87,10 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | $rebuild = Lang::get('rebuild_now'); |
| 90 | - $rebuildLink = PHPCI_URL . 'build/rebuild/' . $build->getId(); |
|
| 90 | + $rebuildLink = PHPCI_URL.'build/rebuild/'.$build->getId(); |
|
| 91 | 91 | |
| 92 | 92 | $delete = Lang::get('delete_build'); |
| 93 | - $deleteLink = PHPCI_URL . 'build/delete/' . $build->getId(); |
|
| 93 | + $deleteLink = PHPCI_URL.'build/delete/'.$build->getId(); |
|
| 94 | 94 | |
| 95 | 95 | $actions = "<a class=\"btn btn-default\" href=\"{$rebuildLink}\">{$rebuild}</a> "; |
| 96 | 96 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | protected function getUiPlugins() |
| 109 | 109 | { |
| 110 | 110 | $rtn = array(); |
| 111 | - $path = APPLICATION_PATH . 'public/assets/js/build-plugins/'; |
|
| 111 | + $path = APPLICATION_PATH.'public/assets/js/build-plugins/'; |
|
| 112 | 112 | $dir = opendir($path); |
| 113 | 113 | |
| 114 | 114 | while ($item = readdir($dir)) { |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | public function meta($buildId) |
| 147 | 147 | { |
| 148 | - $build = BuildFactory::getBuildById($buildId); |
|
| 148 | + $build = BuildFactory::getBuildById($buildId); |
|
| 149 | 149 | $key = $this->getParam('key', null); |
| 150 | 150 | $numBuilds = $this->getParam('num_builds', 1); |
| 151 | 151 | $data = null; |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | public function rebuild($buildId) |
| 194 | 194 | { |
| 195 | - $copy = BuildFactory::getBuildById($buildId); |
|
| 195 | + $copy = BuildFactory::getBuildById($buildId); |
|
| 196 | 196 | |
| 197 | 197 | if (empty($copy)) { |
| 198 | 198 | throw new NotFoundException(Lang::get('build_x_not_found', $buildId)); |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | $build = $this->buildService->createDuplicateBuild($copy); |
| 202 | 202 | |
| 203 | 203 | $response = new b8\Http\Response\RedirectResponse(); |
| 204 | - $response->setHeader('Location', PHPCI_URL.'build/view/' . $build->getId()); |
|
| 204 | + $response->setHeader('Location', PHPCI_URL.'build/view/'.$build->getId()); |
|
| 205 | 205 | return $response; |
| 206 | 206 | } |
| 207 | 207 | |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | $this->buildService->deleteBuild($build); |
| 222 | 222 | |
| 223 | 223 | $response = new b8\Http\Response\RedirectResponse(); |
| 224 | - $response->setHeader('Location', PHPCI_URL.'project/view/' . $build->getProjectId()); |
|
| 224 | + $response->setHeader('Location', PHPCI_URL.'project/view/'.$build->getProjectId()); |
|
| 225 | 225 | return $response; |
| 226 | 226 | } |
| 227 | 227 | |
@@ -405,7 +405,7 @@ |
||
| 405 | 405 | /** |
| 406 | 406 | * Get the validator to use to check project references. |
| 407 | 407 | * @param $values |
| 408 | - * @return callable |
|
| 408 | + * @return \Closure |
|
| 409 | 409 | */ |
| 410 | 410 | protected function getReferenceValidator($values) |
| 411 | 411 | { |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * PHPCI - Continuous Integration for PHP |
|
| 4 | - * |
|
| 5 | - * @copyright Copyright 2014, Block 8 Limited. |
|
| 6 | - * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md |
|
| 7 | - * @link https://www.phptesting.org/ |
|
| 8 | - */ |
|
| 3 | + * PHPCI - Continuous Integration for PHP |
|
| 4 | + * |
|
| 5 | + * @copyright Copyright 2014, Block 8 Limited. |
|
| 6 | + * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md |
|
| 7 | + * @link https://www.phptesting.org/ |
|
| 8 | + */ |
|
| 9 | 9 | |
| 10 | 10 | namespace PHPCI\Controller; |
| 11 | 11 | |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | - * View a specific project. |
|
| 65 | - */ |
|
| 64 | + * View a specific project. |
|
| 65 | + */ |
|
| 66 | 66 | public function view($projectId) |
| 67 | 67 | { |
| 68 | 68 | $branch = $this->getParam('branch', ''); |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | - * Create a new pending build for a project. |
|
| 102 | - */ |
|
| 101 | + * Create a new pending build for a project. |
|
| 102 | + */ |
|
| 103 | 103 | public function build($projectId, $branch = '') |
| 104 | 104 | { |
| 105 | 105 | /* @var \PHPCI\Model\Project $project */ |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
| 125 | - * Delete a project. |
|
| 126 | - */ |
|
| 125 | + * Delete a project. |
|
| 126 | + */ |
|
| 127 | 127 | public function delete($projectId) |
| 128 | 128 | { |
| 129 | 129 | $this->requireAdmin(); |
@@ -137,8 +137,8 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
| 140 | - * AJAX get latest builds. |
|
| 141 | - */ |
|
| 140 | + * AJAX get latest builds. |
|
| 141 | + */ |
|
| 142 | 142 | public function builds($projectId) |
| 143 | 143 | { |
| 144 | 144 | $branch = $this->getParam('branch', ''); |
@@ -178,8 +178,8 @@ discard block |
||
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | /** |
| 181 | - * Add a new project. Handles both the form, and processing. |
|
| 182 | - */ |
|
| 181 | + * Add a new project. Handles both the form, and processing. |
|
| 182 | + */ |
|
| 183 | 183 | public function add() |
| 184 | 184 | { |
| 185 | 185 | $this->layout->title = Lang::get('add_project'); |
@@ -232,8 +232,8 @@ discard block |
||
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | /** |
| 235 | - * Edit a project. Handles both the form and processing. |
|
| 236 | - */ |
|
| 235 | + * Edit a project. Handles both the form and processing. |
|
| 236 | + */ |
|
| 237 | 237 | public function edit($projectId) |
| 238 | 238 | { |
| 239 | 239 | $this->requireAdmin(); |
@@ -296,8 +296,8 @@ discard block |
||
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | /** |
| 299 | - * Create add / edit project form. |
|
| 300 | - */ |
|
| 299 | + * Create add / edit project form. |
|
| 300 | + */ |
|
| 301 | 301 | protected function projectForm($values, $type = 'add') |
| 302 | 302 | { |
| 303 | 303 | $form = new Form(); |
@@ -391,8 +391,8 @@ discard block |
||
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | /** |
| 394 | - * Get an array of repositories from Github's API. |
|
| 395 | - */ |
|
| 394 | + * Get an array of repositories from Github's API. |
|
| 395 | + */ |
|
| 396 | 396 | protected function githubRepositories() |
| 397 | 397 | { |
| 398 | 398 | $github = new Github(); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | $build = $this->buildService->createBuild($project, null, urldecode($branch), $email); |
| 118 | 118 | |
| 119 | 119 | $response = new b8\Http\Response\RedirectResponse(); |
| 120 | - $response->setHeader('Location', PHPCI_URL.'build/view/' . $build->getId()); |
|
| 120 | + $response->setHeader('Location', PHPCI_URL.'build/view/'.$build->getId()); |
|
| 121 | 121 | return $response; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | $build = BuildFactory::getBuild($build); |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - $view->builds = $builds['items']; |
|
| 175 | + $view->builds = $builds['items']; |
|
| 176 | 176 | |
| 177 | 177 | return array($view->render(), $builds['count']); |
| 178 | 178 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | $project = $this->projectService->createProject($title, $type, $reference, $options); |
| 227 | 227 | |
| 228 | 228 | $response = new b8\Http\Response\RedirectResponse(); |
| 229 | - $response->setHeader('Location', PHPCI_URL.'project/view/' . $project->getId()); |
|
| 229 | + $response->setHeader('Location', PHPCI_URL.'project/view/'.$project->getId()); |
|
| 230 | 230 | return $response; |
| 231 | 231 | } |
| 232 | 232 | } |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | |
| 255 | 255 | if ($values['type'] == "gitlab") { |
| 256 | 256 | $accessInfo = $project->getAccessInformation(); |
| 257 | - $reference = $accessInfo["user"].'@'.$accessInfo["domain"].':' . $project->getReference().".git"; |
|
| 257 | + $reference = $accessInfo["user"].'@'.$accessInfo["domain"].':'.$project->getReference().".git"; |
|
| 258 | 258 | $values['reference'] = $reference; |
| 259 | 259 | } |
| 260 | 260 | |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | $values = $this->getParams(); |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | - $form = $this->projectForm($values, 'edit/' . $projectId); |
|
| 265 | + $form = $this->projectForm($values, 'edit/'.$projectId); |
|
| 266 | 266 | |
| 267 | 267 | if ($method != 'POST' || ($method == 'POST' && !$form->validate())) { |
| 268 | 268 | $view = new b8\View('ProjectForm'); |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | $project = $this->projectService->updateProject($project, $title, $type, $reference, $options); |
| 292 | 292 | |
| 293 | 293 | $response = new b8\Http\Response\RedirectResponse(); |
| 294 | - $response->setHeader('Location', PHPCI_URL.'project/view/' . $project->getId()); |
|
| 294 | + $response->setHeader('Location', PHPCI_URL.'project/view/'.$project->getId()); |
|
| 295 | 295 | return $response; |
| 296 | 296 | } |
| 297 | 297 | |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | { |
| 303 | 303 | $form = new Form(); |
| 304 | 304 | $form->setMethod('POST'); |
| 305 | - $form->setAction(PHPCI_URL.'project/' . $type); |
|
| 305 | + $form->setAction(PHPCI_URL.'project/'.$type); |
|
| 306 | 306 | $form->addField(new Form\Element\Csrf('csrf')); |
| 307 | 307 | $form->addField(new Form\Element\Hidden('pubkey')); |
| 308 | 308 | |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | */ |
| 410 | 410 | protected function getReferenceValidator($values) |
| 411 | 411 | { |
| 412 | - return function ($val) use ($values) { |
|
| 412 | + return function($val) use ($values) { |
|
| 413 | 413 | $type = $values['type']; |
| 414 | 414 | |
| 415 | 415 | $validators = array( |
@@ -163,7 +163,6 @@ |
||
| 163 | 163 | * |
| 164 | 164 | * @param Project $project |
| 165 | 165 | * @param array $payload |
| 166 | - * @param b8\Http\Response\JsonResponse $response |
|
| 167 | 166 | * |
| 168 | 167 | * @return b8\Http\Response\JsonResponse |
| 169 | 168 | */ |
@@ -12,7 +12,6 @@ |
||
| 12 | 12 | use b8; |
| 13 | 13 | use b8\Store; |
| 14 | 14 | use Exception; |
| 15 | -use PHPCI\BuildFactory; |
|
| 16 | 15 | use PHPCI\Model\Project; |
| 17 | 16 | use PHPCI\Service\BuildService; |
| 18 | 17 | use PHPCI\Store\BuildStore; |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * PHPCI - Continuous Integration for PHP |
|
| 4 | - * |
|
| 5 | - * @copyright Copyright 2014-2015, Block 8 Limited. |
|
| 6 | - * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md |
|
| 7 | - * @link https://www.phptesting.org/ |
|
| 8 | - */ |
|
| 3 | + * PHPCI - Continuous Integration for PHP |
|
| 4 | + * |
|
| 5 | + * @copyright Copyright 2014-2015, Block 8 Limited. |
|
| 6 | + * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md |
|
| 7 | + * @link https://www.phptesting.org/ |
|
| 8 | + */ |
|
| 9 | 9 | |
| 10 | 10 | namespace PHPCI\Controller; |
| 11 | 11 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | $token = \b8\Config::getInstance()->get('phpci.github.token'); |
| 233 | 233 | |
| 234 | 234 | if (!empty($token)) { |
| 235 | - $headers[] = 'Authorization: token ' . $token; |
|
| 235 | + $headers[] = 'Authorization: token '.$token; |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | $url = $payload['pull_request']['commits_url']; |
@@ -383,14 +383,14 @@ discard block |
||
| 383 | 383 | $project = $this->projectStore->getById($projectId); |
| 384 | 384 | |
| 385 | 385 | if (empty($projectId)) { |
| 386 | - throw new Exception('Project does not exist: ' . $projectId); |
|
| 386 | + throw new Exception('Project does not exist: '.$projectId); |
|
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | if (is_array($expectedType) |
| 390 | 390 | ? !in_array($project->getType(), $expectedType) |
| 391 | 391 | : $project->getType() !== $expectedType |
| 392 | 392 | ) { |
| 393 | - throw new Exception('Wrong project type: ' . $project->getType()); |
|
| 393 | + throw new Exception('Wrong project type: '.$project->getType()); |
|
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | return $project; |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | { |
| 22 | 22 | /** |
| 23 | 23 | * Make a request to the Github API. |
| 24 | - * @param $url |
|
| 24 | + * @param string $url |
|
| 25 | 25 | * @param $params |
| 26 | 26 | * @return mixed |
| 27 | 27 | */ |
@@ -105,11 +105,11 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | /** |
| 107 | 107 | * Create a comment on a specific file (and commit) in a Github Pull Request. |
| 108 | - * @param $repo |
|
| 108 | + * @param string $repo |
|
| 109 | 109 | * @param $pullId |
| 110 | - * @param $commitId |
|
| 110 | + * @param string $commitId |
|
| 111 | 111 | * @param $file |
| 112 | - * @param $line |
|
| 112 | + * @param integer $line |
|
| 113 | 113 | * @param $comment |
| 114 | 114 | * @return null |
| 115 | 115 | */ |
@@ -141,10 +141,10 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | /** |
| 143 | 143 | * Create a comment on a Github commit. |
| 144 | - * @param $repo |
|
| 145 | - * @param $commitId |
|
| 144 | + * @param string $repo |
|
| 145 | + * @param string $commitId |
|
| 146 | 146 | * @param $file |
| 147 | - * @param $line |
|
| 147 | + * @param integer $line |
|
| 148 | 148 | * @param $comment |
| 149 | 149 | * @return null |
| 150 | 150 | */ |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * PHPCI - Continuous Integration for PHP |
|
| 4 | - * |
|
| 5 | - * @copyright Copyright 2014, Block 8 Limited. |
|
| 6 | - * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md |
|
| 7 | - * @link https://www.phptesting.org/ |
|
| 8 | - */ |
|
| 3 | + * PHPCI - Continuous Integration for PHP |
|
| 4 | + * |
|
| 5 | + * @copyright Copyright 2014, Block 8 Limited. |
|
| 6 | + * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md |
|
| 7 | + * @link https://www.phptesting.org/ |
|
| 8 | + */ |
|
| 9 | 9 | |
| 10 | 10 | namespace PHPCI\Helper; |
| 11 | 11 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | return null; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - $url = '/repos/' . strtolower($repo) . '/pulls/' . $pullId . '/comments'; |
|
| 124 | + $url = '/repos/'.strtolower($repo).'/pulls/'.$pullId.'/comments'; |
|
| 125 | 125 | |
| 126 | 126 | $params = array( |
| 127 | 127 | 'body' => $comment, |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $http = new HttpClient('https://api.github.com'); |
| 134 | 134 | $http->setHeaders(array( |
| 135 | 135 | 'Content-Type: application/x-www-form-urlencoded', |
| 136 | - 'Authorization: Basic ' . base64_encode($token . ':x-oauth-basic'), |
|
| 136 | + 'Authorization: Basic '.base64_encode($token.':x-oauth-basic'), |
|
| 137 | 137 | )); |
| 138 | 138 | |
| 139 | 139 | $http->post($url, json_encode($params)); |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | return null; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - $url = '/repos/' . strtolower($repo) . '/commits/' . $commitId . '/comments'; |
|
| 159 | + $url = '/repos/'.strtolower($repo).'/commits/'.$commitId.'/comments'; |
|
| 160 | 160 | |
| 161 | 161 | $params = array( |
| 162 | 162 | 'body' => $comment, |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $http = new HttpClient('https://api.github.com'); |
| 168 | 168 | $http->setHeaders(array( |
| 169 | 169 | 'Content-Type: application/x-www-form-urlencoded', |
| 170 | - 'Authorization: Basic ' . base64_encode($token . ':x-oauth-basic'), |
|
| 170 | + 'Authorization: Basic '.base64_encode($token.':x-oauth-basic'), |
|
| 171 | 171 | )); |
| 172 | 172 | |
| 173 | 173 | $http->post($url, json_encode($params)); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | /** |
| 26 | 26 | * Get a specific string from the language file. |
| 27 | 27 | * |
| 28 | - * @param $string |
|
| 28 | + * @param string $string |
|
| 29 | 29 | * @return mixed|string |
| 30 | 30 | */ |
| 31 | 31 | public static function get($string) |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | /** |
| 52 | 52 | * Get the currently active language. |
| 53 | 53 | * |
| 54 | - * @return string|null |
|
| 54 | + * @return string |
|
| 55 | 55 | */ |
| 56 | 56 | public static function getLanguage() |
| 57 | 57 | { |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * PHPCI - Continuous Integration for PHP |
|
| 4 | - * |
|
| 5 | - * @copyright Copyright 2014, Block 8 Limited. |
|
| 6 | - * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md |
|
| 7 | - * @link https://www.phptesting.org/ |
|
| 8 | - */ |
|
| 3 | + * PHPCI - Continuous Integration for PHP |
|
| 4 | + * |
|
| 5 | + * @copyright Copyright 2014, Block 8 Limited. |
|
| 6 | + * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md |
|
| 7 | + * @link https://www.phptesting.org/ |
|
| 8 | + */ |
|
| 9 | 9 | |
| 10 | 10 | namespace PHPCI\Helper; |
| 11 | 11 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | return call_user_func_array('sprintf', $vars); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - return '%%MISSING STRING: ' . $string . '%%'; |
|
| 40 | + return '%%MISSING STRING: '.$string.'%%'; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | foreach (self::$languages as $language) { |
| 89 | 89 | $strings = array(); |
| 90 | - require(PHPCI_DIR . 'PHPCI/Languages/lang.' . $language . '.php'); |
|
| 90 | + require(PHPCI_DIR.'PHPCI/Languages/lang.'.$language.'.php'); |
|
| 91 | 91 | $languages[$language] = $strings['language_name']; |
| 92 | 92 | } |
| 93 | 93 | |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | protected static function loadLanguage() |
| 152 | 152 | { |
| 153 | - $langFile = PHPCI_DIR . 'PHPCI/Languages/lang.' . self::$language . '.php'; |
|
| 153 | + $langFile = PHPCI_DIR.'PHPCI/Languages/lang.'.self::$language.'.php'; |
|
| 154 | 154 | |
| 155 | 155 | if (!file_exists($langFile)) { |
| 156 | 156 | return null; |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | protected static function loadAvailableLanguages() |
| 172 | 172 | { |
| 173 | 173 | $matches = array(); |
| 174 | - foreach (glob(PHPCI_DIR . 'PHPCI/Languages/lang.*.php') as $file) { |
|
| 174 | + foreach (glob(PHPCI_DIR.'PHPCI/Languages/lang.*.php') as $file) { |
|
| 175 | 175 | if (preg_match('/lang\.([a-z]{2}\-?[a-z]*)\.php/', $file, $matches)) { |
| 176 | 176 | self::$languages[] = $matches[1]; |
| 177 | 177 | } |