From d74908526d0c84ae372eaef9be00c7f30f10cac1 Mon Sep 17 00:00:00 2001 From: Stephen Date: Tue, 2 Jan 2018 11:09:22 -0600 Subject: [PATCH 1/5] Adds method to get tokens passed to command. --- src/Commando/Command.php | 5 +++++ tests/Commando/CommandTest.php | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/src/Commando/Command.php b/src/Commando/Command.php index bcf2ebb..813a7ba 100755 --- a/src/Commando/Command.php +++ b/src/Commando/Command.php @@ -206,6 +206,11 @@ public function __call($name, $arguments) return $this; } + public function getTokens() { + $this->parseIfNotParsed(); + return $this->tokens; + } + /** * @param Option|null $option * @param string|int $name diff --git a/tests/Commando/CommandTest.php b/tests/Commando/CommandTest.php index 40a05c1..ba9236d 100755 --- a/tests/Commando/CommandTest.php +++ b/tests/Commando/CommandTest.php @@ -206,4 +206,12 @@ public function testRequirementsOnOptionsMissing() ->needs('b'); } + public function testGetTokensPassedToCommand() + { + $tokens = array('-a'); + $cmd = new Command($tokens); + $retrievedTokens = $cmd->getTokens(); + $this->assertEquals($tokens, $retrievedTokens); + } + } \ No newline at end of file From 4d3692aa412d665ff2ff0b1dd6f1a446c4548cbf Mon Sep 17 00:00:00 2001 From: Stephen Date: Tue, 2 Jan 2018 11:21:03 -0600 Subject: [PATCH 2/5] gets rid of unnecessary parseIfNotParsed call. --- src/Commando/Command.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Commando/Command.php b/src/Commando/Command.php index 813a7ba..e4835a1 100755 --- a/src/Commando/Command.php +++ b/src/Commando/Command.php @@ -207,7 +207,9 @@ public function __call($name, $arguments) } public function getTokens() { - $this->parseIfNotParsed(); + if (empty($this->tokens)){ + return array(); + } return $this->tokens; } From 6364dda42f0839153dba2691070ccd6626ed6860 Mon Sep 17 00:00:00 2001 From: Stephen Date: Tue, 2 Jan 2018 11:22:43 -0600 Subject: [PATCH 3/5] fixes issue with travis ci no longer supporting 5.3 anywhere other than precise. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 2f72936..4483b8c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ before_script: - cd tests php: - 5.3 + dist: precise - 5.4 - 5.5 - 5.6 \ No newline at end of file From 8488baa8c9546890b428dfa2aa81bcc77436531a Mon Sep 17 00:00:00 2001 From: Stephen Date: Tue, 2 Jan 2018 11:24:18 -0600 Subject: [PATCH 4/5] tries to fix travis ci issue. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4483b8c..2cbe84f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ before_script: - cd tests php: - 5.3 - dist: precise + dist: precise - 5.4 - 5.5 - 5.6 \ No newline at end of file From bd593b0ab5d9aff4d3165515f06f02f3518d663e Mon Sep 17 00:00:00 2001 From: Stephen Date: Tue, 2 Jan 2018 11:26:15 -0600 Subject: [PATCH 5/5] tries to fix travis ci issue. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2cbe84f..1f776e6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,9 +2,9 @@ language: php before_script: - composer install - cd tests +dist: precise php: - 5.3 - dist: precise - 5.4 - 5.5 - 5.6 \ No newline at end of file