DbPatch_Core_Console::getCommand PHP Method

getCommand() public method

Returns the command parameter from the command line
public getCommand ( ) : string
return string
    public function getCommand()
    {
        $command = '';
        foreach ($this->arguments as $arg) {
            if (strpos($arg, '--') === false) {
                $command = $arg;
                break;
            }
        }
        return $command;
    }

Usage Example

Example #1
0
 public function testHelpCommand()
 {
     $argv = array('./dbpatch.php', 'help', 'update');
     $console = new DbPatch_Core_Console($argv);
     $this->assertEquals('help', $console->getCommand());
     $this->assertEquals(array('update' => 'update'), $console->getOptions());
 }