-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from phalcon/v1.1.0
V1.1.0
- Loading branch information
Showing
6 changed files
with
17 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,13 @@ | ||
<?php | ||
|
||
/* | ||
+------------------------------------------------------------------------+ | ||
| Phalcon Cli option parser | | ||
+------------------------------------------------------------------------+ | ||
| Copyright (c) 2011-present Phalcon Team (https://www.phalconphp.com) | | ||
+------------------------------------------------------------------------+ | ||
| This source file is subject to the New BSD License that is bundled | | ||
| with this package in the file LICENSE.txt. | | ||
| | | ||
| If you did not receive a copy of the license and are unable to | | ||
| obtain it through the world-wide-web, please send an email | | ||
| to [email protected] so we can send you a copy immediately. | | ||
+------------------------------------------------------------------------+ | ||
| Authors: Sergii Svyrydenko <[email protected]> | | ||
+------------------------------------------------------------------------+ | ||
*/ | ||
/** | ||
* This file is part of the Cop package. | ||
* | ||
* (c) Phalcon Team <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Phalcon\Cop; | ||
|
||
|
@@ -44,16 +36,17 @@ class Parser | |
]; | ||
|
||
/** | ||
* Parse CLI command | ||
* Parse console input. | ||
* | ||
* @param array $argv | ||
* @param array $argv | ||
* @return array | ||
*/ | ||
public function parse(array $argv = []): array | ||
{ | ||
if (empty($argv)) { | ||
$argv = $this->getArgvFromServer(); | ||
} | ||
|
||
array_shift($argv); | ||
$this->parsedCommands = []; | ||
|
||
|
@@ -81,18 +74,13 @@ public function getBoolean(string $key, bool $default = false): bool | |
} | ||
|
||
/** | ||
* Get console command either from argument or from Server | ||
* Gets array of arguments passed from the input. | ||
* | ||
* @return array | ||
* @throws Exception | ||
*/ | ||
protected function getArgvFromServer(): array | ||
{ | ||
if (!empty($_SERVER['argv'])) { | ||
return $_SERVER['argv']; | ||
} | ||
|
||
throw new Exception("Parameters haven't been defined yet"); | ||
return empty($_SERVER['argv']) ? [] : $_SERVER['argv']; | ||
} | ||
|
||
/** | ||
|
This file was deleted.
Oops, something went wrong.