Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
[PSR-2] fixers=braces,elseif,short_tag,php_closing_tag,trailing_space…
Browse files Browse the repository at this point in the history
…s,linefeed

Applied php-cs-fixer --fixers=braces,elseif,short_tag,php_closing_tag,trailing_spaces,linefeed
  • Loading branch information
Maks3w committed Jul 12, 2012
1 parent a257169 commit e53a267
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ class InvalidArgumentException
extends \InvalidArgumentException
implements ExceptionInterface
{
}

}
17 changes: 7 additions & 10 deletions src/Getopt.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions test/GetoptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public function testGetoptUnSetBeforeParse()
unset($opts->a);
$this->assertFalse(isset($opts->a));
}

/**
* @group ZF-5948
*/
Expand Down Expand Up @@ -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'));
}
Expand All @@ -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();
}
Expand Down Expand Up @@ -490,7 +490,7 @@ public function testUsingDashWithoutOptionNameAsLastArgumentIsRecognizedAsRemain
public function testUsingDashWithoutOptionNotAsLastArgumentThrowsException()
{
$opts = new Getopt("abp:", array("-", "file1"));

$this->setExpectedException('\Zend\Console\Exception\RuntimeException');
$opts->parse();
}
Expand All @@ -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');
}
Expand All @@ -535,7 +535,7 @@ public function testGetoptWithCumulativeParamsOptionHandleArrayValues()
public function testGetoptIgnoreCumulativeFlagsByDefault()
{
$opts = new Getopt('v', array('-v', '-v', '-v'));

$this->assertEquals(true, $opts->v);
}

Expand Down

0 comments on commit e53a267

Please sign in to comment.