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

Commit

Permalink
Merge branch 'hotfix/coding-standards' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/Adapter/AbstractAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function writeLine($text = "", $color = null, $bgColor = null)
} elseif ($width == $consoleWidth) {
$this->write($text, $color, $bgColor);
} else {
$this->write($text. "\n", $color, $bgColor);
$this->write($text . "\n", $color, $bgColor);
}
}

Expand Down Expand Up @@ -609,7 +609,7 @@ public function readChar($mask = null)
$f = fopen('php://stdin','r');
do {
$char = fread($f,1);
} while ($mask === null || stristr($mask,$char));
} while ($mask === null || stristr($mask, $char));
fclose($f);
return $char;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Posix.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function getWidth()
/**
* Try to read console size from "tput" command
*/
$result = exec('tput cols',$output, $return);
$result = exec('tput cols', $output, $return);
if (!$return && is_numeric($result)) {
return $width = (int)$result;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Windows.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ public function readChar($mask = null)
public function readLine($maxLength = 2048)
{
$f = fopen('php://stdin','r');
$line = rtrim(fread($f,$maxLength),"\r\n");
$line = rtrim(fread($f, $maxLength),"\r\n");
fclose($f);

return $line;
Expand Down
4 changes: 2 additions & 2 deletions src/Adapter/WindowsAnsicon.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public function readChar($mask = null)
$result = $return = null;
exec(
'powershell -NonInteractive -NoProfile -NoLogo -OutputFormat Text -Command "'
. '[int[]] $mask = '.join(',',$asciiMask).';'
. '[int[]] $mask = '.join(',', $asciiMask).';'
. 'do {'
. '$key = $Host.UI.RawUI.ReadKey(\'NoEcho,IncludeKeyDown\').VirtualKeyCode;'
. '} while( !($mask -contains $key) );'
Expand All @@ -276,7 +276,7 @@ public function readChar($mask = null)

$char = !empty($result) ? trim(implode('', $result)) : null;

if (!$return && $char && ($mask === null || in_array($char,$asciiMask))) {
if (!$return && $char && ($mask === null || in_array($char, $asciiMask))) {
// We have obtained an ASCII code, check if it is a carriage
// return and normalize it as needed
if ($char == 13) {
Expand Down
4 changes: 2 additions & 2 deletions src/Prompt/Char.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function show()
$mask .= strtoupper($mask); // uppercase and append
$mask = str_split($mask); // convert to array
$mask = array_unique($mask); // remove duplicates
$mask = implode("",$mask); // convert back to string
$mask = implode("", $mask); // convert back to string
}

do {
Expand All @@ -121,7 +121,7 @@ public function show()
/**
* Check if it is an allowed char
*/
if (stristr($this->allowedChars,$char) !== false) {
if (stristr($this->allowedChars, $char) !== false) {
if ($this->echo) {
echo trim($char)."\n";
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/Prompt/Confirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function show()
public function setNoChar($noChar)
{
$this->noChar = $noChar;
$this->setAllowedChars($this->yesChar.$this->noChar);
$this->setAllowedChars($this->yesChar . $this->noChar);
}

/**
Expand All @@ -102,7 +102,7 @@ public function getNoChar()
public function setYesChar($yesChar)
{
$this->yesChar = $yesChar;
$this->setAllowedChars($this->yesChar.$this->noChar);
$this->setAllowedChars($this->yesChar . $this->noChar);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Prompt/Number.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ public function show()
$this->getConsole()->writeLine("$number is not a number\n");
$valid = false;
} elseif (!$this->allowFloat && (round($number) != $number) ) {
$this->getConsole()->writeLine("Please enter a non-floating number, i.e. ".round($number)."\n");
$this->getConsole()->writeLine("Please enter a non-floating number, i.e. " . round($number) . "\n");
$valid = false;
} elseif ($this->max !== null && $number > $this->max) {
$this->getConsole()->writeLine("Please enter a number not greater than ".$this->max."\n");
$this->getConsole()->writeLine("Please enter a number not greater than " . $this->max . "\n");
$valid = false;
} elseif ($this->min !== null && $number < $this->min) {
$this->getConsole()->writeLine("Please enter a number not smaller than ".$this->min."\n");
$this->getConsole()->writeLine("Please enter a number not smaller than " . $this->min . "\n");
$valid = false;
}
} while (!$valid);
Expand Down
2 changes: 1 addition & 1 deletion src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public function env()
*/
public function toString()
{
return trim(implode(' ',$this->params()->toArray()));
return trim(implode(' ', $this->params()->toArray()));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/GetoptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ public function testEqualsCharacterInLongOptionsValue()

$opts = new Getopt(
array('foo=s' => 'Option One (string)'),
array('--foo='.$fooValue)
array('--foo=' . $fooValue)
);
$this->assertEquals($fooValue, $opts->foo);
}
Expand Down

0 comments on commit 72a3295

Please sign in to comment.