diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-11-29 12:28:35 -0500 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-11-29 12:28:35 -0500 |
commit | e8fa25f9ca246fea085da46ea705a74b6de30d10 (patch) | |
tree | abf0fd767540e89ba5cfbbb7b6cabb64c4fcbb4e /app/Core | |
parent | d9879161281785c8e11fd074cec98f09df94dd46 (diff) |
Replace Core\Cli by Symfony\Console
Diffstat (limited to 'app/Core')
-rw-r--r-- | app/Core/Cli.php | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/app/Core/Cli.php b/app/Core/Cli.php deleted file mode 100644 index 13533b9a..00000000 --- a/app/Core/Cli.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php - -namespace Core; - -use Closure; - -/** - * CLI class - * - * @package core - * @author Frederic Guillot - */ -class Cli -{ - /** - * Default command name - * - * @access public - * @var string - */ - public $default_command = 'help'; - - /** - * List of registered commands - * - * @access private - * @var array - */ - private $commands = array(); - - /** - * - * - * @access public - * @param string $command Command name - * @param Closure $callback Command callback - */ - public function register($command, Closure $callback) - { - $this->commands[$command] = $callback; - } - - /** - * Execute a command - * - * @access public - * @param string $command Command name - */ - public function call($command) - { - if (isset($this->commands[$command])) { - $this->commands[$command](); - exit; - } - } - - /** - * Determine which command to execute - * - * @access public - */ - public function execute() - { - if (php_sapi_name() !== 'cli') { - die('This script work only from the command line.'); - } - - if ($GLOBALS['argc'] === 1) { - $this->call($this->default_command); - } - - $this->call($GLOBALS['argv'][1]); - $this->call($this->default_command); - } -} |