/** * Adds Actions and Listeners to the Application * * @param Application $app The running Application * * @return void */ public function load(Application $app) { $app->register('PageView', ProxyFactory::factory('Nitronet\\Fwk\\CMF\\Controllers\\PageView:show')); $console = $this->cfg('consoleService', false); if ($console) { $app->addListener(new CommandsListener($this->cfg('consoleService', 'console'), $this->cfg('serviceName', 'cmf'))); } }
public function testDirectResponse() { $rsp = new \Symfony\Component\HttpFoundation\Response(); $this->object->register('TestDirectResponse', ProxyFactory::factory(function () use($rsp) { return $rsp; })); $request = Request::create('/TestDirectResponse.action'); $response = $this->object->run($request); $this->assertEquals($rsp, $response); }
/** * @return Application */ public function execute($appName, Container $services = null) { $this->sources = array_reverse($this->sources); $app = Application::factory($appName, $services); if (null === $services) { $services = $app->getServices(); } $app->addListener(new DescriptorListener($this)); $this->loadIniFiles(); $this->loadServices($services); foreach ($this->loadListeners($services) as $listener) { $app->addListener($listener); } foreach ($this->loadPlugins($services) as $plugin) { $app->plugin($plugin); } foreach ($this->loadActions() as $actionName => $str) { $app->register($actionName, ProxyFactory::factory($str)); } return $app; }
public function load(Application $app) { $app->register('PluginAction', ProxyFactory::factory(function () { return 'plugin'; })); }
/** * Adds Actions and Listeners to the Application * * @param Application $app The running Application * * @return void */ public function load(Application $app) { $app->register('CommentsThread', PF::factory('Nitronet\\Fwk\\Comments\\Controllers\\Thread:show')); $app->register('CommentsCount', PF::factory('Nitronet\\Fwk\\Comments\\Controllers\\Thread:countComments')); $app->register('CommentPost', PF::factory('Nitronet\\Fwk\\Comments\\Controllers\\Comment:post')); }
public function load(Application $app) { $app->register($this->cfg('action', 'Asset'), PF::factory($this->cfg('controller', 'Nitronet\\Fwk\\Assetic\\Controllers\\AssetAction:show'))); }
public function offsetSet($actionName, $proxy) { if (!$proxy instanceof ActionProxy) { $proxy = Action\ProxyFactory::factory($proxy); } return $this->register($actionName, $proxy); }