From e53a2678042acd02daacfaa48d3ca87e0042d4aa Mon Sep 17 00:00:00 2001 From: Maks3w Date: Thu, 12 Jul 2012 21:11:36 +0200 Subject: [PATCH] [PSR-2] fixers=braces,elseif,short_tag,php_closing_tag,trailing_spaces,linefeed Applied php-cs-fixer --fixers=braces,elseif,short_tag,php_closing_tag,trailing_spaces,linefeed --- src/Exception/InvalidArgumentException.php | 4 ++-- src/Getopt.php | 17 +++++++---------- test/GetoptTest.php | 12 ++++++------ 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/Exception/InvalidArgumentException.php b/src/Exception/InvalidArgumentException.php index abd21dd..a00add4 100644 --- a/src/Exception/InvalidArgumentException.php +++ b/src/Exception/InvalidArgumentException.php @@ -14,5 +14,5 @@ class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface { - -} + +} diff --git a/src/Getopt.php b/src/Getopt.php index 2113acb..22aa8f1 100644 --- a/src/Getopt.php +++ b/src/Getopt.php @@ -603,8 +603,7 @@ public function getUsageMessage() */ public function setAliases($aliasMap) { - foreach ($aliasMap as $flag => $alias) - { + foreach ($aliasMap as $flag => $alias) { if ($this->_getoptConfig[self::CONFIG_IGNORECASE]) { $flag = strtolower($flag); $alias = strtolower($alias); @@ -634,8 +633,7 @@ public function setAliases($aliasMap) */ public function setHelp($helpMap) { - foreach ($helpMap as $flag => $help) - { + foreach ($helpMap as $flag => $help) { if (!isset($this->_ruleMap[$flag])) { continue; } @@ -672,7 +670,7 @@ public function parse() } if (substr($argv[0], 0, 2) == '--') { $this->_parseLongOption($argv); - } else if (substr($argv[0], 0, 1) == '-' && ('-' != $argv[0] || count($argv) >1)) { + } elseif (substr($argv[0], 0, 1) == '-' && ('-' != $argv[0] || count($argv) >1)) { $this->_parseShortOptionCluster($argv); } else if($this->_getoptConfig[self::CONFIG_PARSEALL]) { $this->_remainingArgs[] = array_shift($argv); @@ -760,7 +758,7 @@ protected function _parseSingleOption($flag, &$argv) } else { $realFlag = $this->_ruleMap[$flag]; } - + switch ($this->_rules[$realFlag]['param']) { case 'required': if (count($argv) > 0) { @@ -810,10 +808,10 @@ protected function _setNumericOptionValue($value) return $this->_setSingleOptionValue($this->_getoptConfig['numericFlagsOption'], $value); } - + /** * Add relative to options' flag value - * + * * If options list already has current flag as key * and parser should follow cumulative params by configuration, * we should to add new param to array, not to overwrite @@ -941,8 +939,7 @@ protected function _addRulesModeGnu($rules) */ protected function _addRulesModeZend($rules) { - foreach ($rules as $ruleCode => $helpMessage) - { + foreach ($rules as $ruleCode => $helpMessage) { // this may have to translate the long parm type if there // are any complaints that =string will not work (even though that use // case is not documented) diff --git a/test/GetoptTest.php b/test/GetoptTest.php index cb58c06..3ef5cba 100644 --- a/test/GetoptTest.php +++ b/test/GetoptTest.php @@ -227,7 +227,7 @@ public function testGetoptUnSetBeforeParse() unset($opts->a); $this->assertFalse(isset($opts->a)); } - + /** * @group ZF-5948 */ @@ -319,7 +319,7 @@ public function testGetoptSetAliasesWithNamingConflict() { $opts = new Getopt('abp:', array('--apple')); $opts->setAliases(array('a' => 'apple')); - + $this->setExpectedException('\Zend\Console\Exception\InvalidArgumentException', 'defined more than once'); $opts->setAliases(array('b' => 'apple')); } @@ -329,7 +329,7 @@ public function testGetoptSetAliasesInvalid() $opts = new Getopt('abp:', array('--apple')); $opts->setAliases(array('c' => 'cumquat')); $opts->setArguments(array('-c')); - + $this->setExpectedException('\Zend\Console\Exception\RuntimeException', 'not recognized'); $opts->parse(); } @@ -490,7 +490,7 @@ public function testUsingDashWithoutOptionNameAsLastArgumentIsRecognizedAsRemain public function testUsingDashWithoutOptionNotAsLastArgumentThrowsException() { $opts = new Getopt("abp:", array("-", "file1")); - + $this->setExpectedException('\Zend\Console\Exception\RuntimeException'); $opts->parse(); } @@ -515,7 +515,7 @@ public function testGetoptIgnoreCumulativeParamsByDefault() array('colors=s' => 'Colors-option'), array('--colors=red', '--colors=green', '--colors=blue') ); - + $this->assertInternalType('string', $opts->colors); $this->assertEquals('blue', $opts->colors, 'Should be equal to last variable'); } @@ -535,7 +535,7 @@ public function testGetoptWithCumulativeParamsOptionHandleArrayValues() public function testGetoptIgnoreCumulativeFlagsByDefault() { $opts = new Getopt('v', array('-v', '-v', '-v')); - + $this->assertEquals(true, $opts->v); }