Pimple
This commit is contained in:
parent
4ad5d79f00
commit
050f47afaf
3 changed files with 22 additions and 1 deletions
|
|
@ -5,6 +5,8 @@ require_once __DIR__ . '/../vendor/autoload.php';
|
|||
|
||||
use Deblan\Application;
|
||||
use Deblan\ConfigLoader;
|
||||
use Guzzle\Service\Client;
|
||||
use Deblan\Helper\LiveCoding;
|
||||
|
||||
$app = new Application('LiveCoding CLI', '1');
|
||||
|
||||
|
|
@ -12,4 +14,9 @@ $app->chdir(__DIR__.'/../');
|
|||
$app->addCommandsPath('src/Deblan/Command/', 'Deblan\\Command');
|
||||
$app->loadCommands();
|
||||
$app->setConfigLoader(new ConfigLoader());
|
||||
|
||||
$app->getContainer()['livecoding'] = function() use ($app) {
|
||||
return new LiveCoding($app);
|
||||
};
|
||||
|
||||
$app->run();
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
"symfony/finder": "^2.7",
|
||||
"symfony/console": "^2.7",
|
||||
"symfony/yaml": "^2.7",
|
||||
"symfony/process": "^2.7"
|
||||
"symfony/process": "^2.7",
|
||||
"pimple/pimple": "^3.0",
|
||||
"guzzle/guzzle": "^3.9"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use ReflectionClass;
|
|||
use ReflectionException;
|
||||
use Symfony\Component\Console\Application as BaseApplication;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Pimple\Container;
|
||||
|
||||
/**
|
||||
* Class Application
|
||||
|
|
@ -17,6 +18,8 @@ class Application extends BaseApplication
|
|||
|
||||
protected $configLoader;
|
||||
|
||||
protected $container;
|
||||
|
||||
public function addCommandsPath($path, $namespace)
|
||||
{
|
||||
$this->commandsPaths[$path] = trim($namespace, '\\');
|
||||
|
|
@ -99,4 +102,13 @@ class Application extends BaseApplication
|
|||
{
|
||||
return $this->getConfigLoader()->getConfig()['debug'];
|
||||
}
|
||||
|
||||
public function getContainer()
|
||||
{
|
||||
if (null !== $this->container) {
|
||||
return $this->container;
|
||||
}
|
||||
|
||||
return $this->container = new Container();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue