private function __construct(array $config, array $providers, array $routes, array $events) { !empty($config['app']) && $this->initAppByConfig($config['app']); Config::init($config); $this->serviceContainer = ServiceContainer::getInstance($providers); $this->router = Router::getInstance($routes); Url::setRouter($this->router); EventManager::init($events); }
public function bar($productName) { $event = new DemoEvent('DemoEvent'); EventManager::fire($event); $container = $this->app->getServiceContainer(); $shop = $container->get('shop'); $log = new LogHandler(); $shopProxy = Proxy::newProxyInstance($shop, $log); $shopProxy->buy($productName); return View::render('Demo:Foo:bar.php', ['controllerName' => 'FooController', 'actionName' => 'bar']); }