public function __construct(Container $container = null, CommandBase $parent = null) { parent::__construct($parent); $this->serviceContainer = $container ?: ServiceContainer::getInstance(); if (isset($this->serviceContainer['event'])) { $this->eventService = $this->serviceContainer['event']; } else { $this->eventService = PhpEvent::getInstance(); } // initliaze command loader // TODO: if the service is not defined, we should create them with default settings. $this->loader = $this->serviceContainer['command_loader']; $this->logger = $this->serviceContainer['logger']; $this->formatter = $this->serviceContainer['formatter']; $this->globalConfig = $this->serviceContainer['config']; // get current class namespace, add {App}\Command\ to loader $appRefClass = new ReflectionClass($this); $appNs = $appRefClass->getNamespaceName(); $this->loader->addNamespace('\\' . $appNs . '\\Command'); $this->loader->addNamespace(array('\\CLIFramework\\Command')); $this->supportReadline = extension_loaded('readline'); }
public function __construct(CommandBase $parent = null) { parent::__construct($parent); }