From a2e7374b557faf658e7c2305f638b1f23b9a956b Mon Sep 17 00:00:00 2001 From: Mark Story Date: Mon, 6 Apr 2015 15:17:58 -0400 Subject: [PATCH] Fix PHPCS errors. --- src/Shell/RoutesShell.php | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/src/Shell/RoutesShell.php b/src/Shell/RoutesShell.php index e88e0543cb8..005010cd40e 100644 --- a/src/Shell/RoutesShell.php +++ b/src/Shell/RoutesShell.php @@ -16,8 +16,8 @@ use Cake\Console\Shell; use Cake\Core\Configure; -use Cake\Routing\Router; use Cake\Routing\Exception\MissingRouteException; +use Cake\Routing\Router; /** * Provides interactive CLI tools for routing. @@ -77,21 +77,26 @@ public function generate() } } + /** + * Get the option parser. + * + * @return \Cake\Console\ConsoleOptionParser + */ public function getOptionParser() { $parser = parent::getOptionParser(); $parser->description( - 'Get the list of routes connected in this application. ' . - 'This tool also lets you test URL generation and URL parsing.' - )->addSubcommand('check', [ - 'help' => 'Check a URL string against the routes. ' . - 'Will output the routing parameters the route resolves to.' - ])->addSubcommand('generate', [ - 'help' => 'Check a routing array agains the routes. ' . - "Will output the URL if there is a match.\n\n" . - "Routing parameters should be supplied in a key:value format. " . - "For example `controller:Articles action:view 2`" - ]); + 'Get the list of routes connected in this application. ' . + 'This tool also lets you test URL generation and URL parsing.' + )->addSubcommand('check', [ + 'help' => 'Check a URL string against the routes. ' . + 'Will output the routing parameters the route resolves to.' + ])->addSubcommand('generate', [ + 'help' => 'Check a routing array agains the routes. ' . + "Will output the URL if there is a match.\n\n" . + "Routing parameters should be supplied in a key:value format. " . + "For example `controller:Articles action:view 2`" + ]); return $parser; } @@ -119,7 +124,8 @@ protected function _splitArgs($args) * Takes an array to represent rows, of arrays to represent columns. * Will pad strings to the maximum character length of each column. * - * @param $rows + * @param array $rows The rows to print + * @return void */ protected function _outWithColumns($rows) { @@ -130,7 +136,7 @@ protected function _outWithColumns($rows) array_unshift($rows, ['Route name', 'URI template', 'Defaults']); foreach ($rows as $line) { - for ($i = 0; $i < count($line); $i++) { + for ($i = 0, $len = count($line); $i < $len; $i++) { $elementLength = strlen($line[$i]); if ($elementLength > (isset($maxCharacterLength[$i]) ? $maxCharacterLength[$i] : 0)) { $maxCharacterLength[$i] = $elementLength; @@ -139,7 +145,7 @@ protected function _outWithColumns($rows) } foreach ($rows as $line) { - for ($i = 0; $i < count($line); $i++) { + for ($i = 0, $len = count($line); $i < $len; $i++) { $line[$i] = str_pad($line[$i], $maxCharacterLength[$i], " ", STR_PAD_RIGHT); } $this->out(implode(' ', $line));