Newer
Older
Rodrigo Goncalves
committed
<?php
namespace Ingress\Command;
use Console_CommandLine;
use Console_CommandLine_Command;
use Ingress\Services\CommandRegister;
class BaseCommand
{
protected static function addCommand(Console_CommandLine $commandLine, string $commandName, string $commandDescription, string $callback) {
$cmd = $commandLine->addCommand($commandName, [
'description' => $commandDescription
]);
CommandRegister::$commandMap[$commandName] = $callback;
return $cmd;
}
protected static function addArgument(Console_CommandLine_Command $command, $argumentName, $argumentDescription) {
$command->addArgument($argumentName, ["description" => $argumentDescription]);
return $command;
}
protected static function addOption(Console_CommandLine_Command $command, $optionName, $optionDescription) {
$command->addArgument($optionName, ["description" => $optionDescription]);
return $command;
}
}