Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/ArgvParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class ArgvParser

public function __construct($name, $desc = null, $allowUnknown = false)
{
$this->_name = $name;
$this->_desc = $desc;
$this->_name = $name;
$this->_desc = $desc;
$this->_allowUnknown = $allowUnknown;

$this->addDefaultOptions();
Expand Down Expand Up @@ -65,7 +65,7 @@ public function option($cmd, $desc = '', callable $filter = null, $default = nul
}

$this->_values[$option->attributeName()] = $option->default();
$this->_options[$option->long()] = $option;
$this->_options[$option->long()] = $option;

return $this;
}
Expand All @@ -83,7 +83,7 @@ public function parse(array $argv)
{
\array_shift($argv);

$argv = $this->normalize($argv);
$argv = $this->normalize($argv);
$count = \count($argv);

for ($i = 0; $i < $count; $i++) {
Expand All @@ -110,10 +110,10 @@ protected function parseArgs($arg)

protected function parseOptions($arg, $nextArg, &$i)
{
$value = \substr($nextArg, 0, 1) === '-' ? null : $nextArg;
$value = \substr($nextArg, 0, 1) === '-' ? null : $nextArg;
$isValue = $value !== null;

$this->_lastOption = $option = $this->optionFor($arg);
$this->_lastOption = $option = $this->optionFor($arg);
$this->_wasVariadic = $option ? $option->variadic() : false;

if (!$option) {
Expand Down
6 changes: 3 additions & 3 deletions src/Color.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
*/
class Color
{
const FG_RED = 31;
const FG_GREEN = 32;
const FG_RED = 31;
const FG_GREEN = 32;
const FG_YELLOW = 33;
const FG_BLUE = 36;
const FG_BLUE = 36;
// @todo

protected static $format = "\033[:bold:;:fg:;:bg:m:text:\033[0m";
Expand Down
6 changes: 3 additions & 3 deletions src/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ class Option

public function __construct($cmd, $desc = '', $default = null, callable $filter = null)
{
$this->desc = $desc;
$this->default = $default;
$this->filter = $filter;
$this->desc = $desc;
$this->default = $default;
$this->filter = $filter;
$this->required = \strpos($cmd, '<') !== false;
$this->optional = \strpos($cmd, '[') !== false;

Expand Down
4 changes: 2 additions & 2 deletions tests/ArgvParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public function test_new()
{
$p = new ArgvParser('ArgvParser');

$p->version('0.0.'.rand(1, 10));
$p->version('0.0.' . rand(1, 10));

$data = $this->data();
foreach ($data['options'] as $option) {
Expand All @@ -36,6 +36,6 @@ public function test_new()

public function data()
{
return require __DIR__.'/fixture.php';
return require __DIR__ . '/fixture.php';
}
}
4 changes: 2 additions & 2 deletions tests/OptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function test_filter()
$this->assertSame(10, $o->filter('10'));

$in = 'apple';
$o = new Option('-f, --fruit', 'Age', 'orange', 'strtoupper');
$o = new Option('-f, --fruit', 'Age', 'orange', 'strtoupper');

$this->assertNotSame($o->filter($in), $in);
$this->assertSame('APPLE', $o->filter($in));
Expand All @@ -64,7 +64,7 @@ public function test_filter()

public function data()
{
$f = require __DIR__.'/fixture.php';
$f = require __DIR__ . '/fixture.php';

return $f['options'];
}
Expand Down
2 changes: 1 addition & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php

require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__ . '/../vendor/autoload.php';