class IPF_Cli
{
+ /** @var IPF_Project */
+ private $project;
+
+ /** @var array */
protected $commands;
- public function __construct()
+ public function __construct(IPF_Project $project)
+ {
+ $this->project = $project;
+ }
+
+ public function findCommands()
{
$this->commands = array(
'IPF' => array(
),
);
- foreach (IPF_Project::getInstance()->appList() as $app) {
+ foreach ($this->project->appList() as $app) {
$commands = $app->commands();
if (count($commands))
$this->commands[$app->getName()] = $commands;
}
}
}
-
}
if (php_sapi_name() === 'cli') {
- $cli = new IPF_Cli;
+ $cli = new IPF_Cli($this);
+ $cli->findCommands();
$cli->run();
} else {
$this->request = new IPF_HTTP_Request;