/** * Constructs the app. * * Checks singleton instance * Adds a dependency injector if none provided * Sets the notFound handler * * @param FactoryDefault $dependencyInjector * @throws \RuntimeException */ public function __construct($dependencyInjector = null) { if (self::$app === null) { if ($dependencyInjector === null) { $dependencyInjector = new FactoryDefault(); } $dependencyInjector->setShared('response', Response::class); $dependencyInjector->setShared('router', Router::class); if (!$dependencyInjector->has('eventsManager')) { $dependencyInjector->setShared('eventsManager', \Phalcon\Events\Manager::class); } if (!$dependencyInjector->has('request')) { $dependencyInjector->setShared('request', \Phalcon\Http\Request::class); } parent::__construct($dependencyInjector); self::$app = $this; $this->setEventsManager($dependencyInjector->getShared('eventsManager')); $this->addHeaderHandler(new HeaderHandler\Accept()); $app = self::$app; $this->_errorHandler = function (\Exception $ex) { return $this->errorHandler($ex); }; $this->_notFoundHandler = function () { return $this->notFoundHandler(); }; } else { throw new \RuntimeException("Can't instance App more than once"); } }
public function __construct($dependencyInjector = null, $options = []) { $defaultOptions = ['cacheService' => 'cache']; $this->options = array_merge($defaultOptions, $options); $dependencyInjector->set('request', '\\ApiBird\\Request', true); $dependencyInjector->set('response', '\\ApiBird\\Response', true); set_error_handler(function ($errno, $errstr, $errfile, $errline) { throw new \ErrorException($errstr, 0, $errno, $errfile, $errline); }); parent::__construct($dependencyInjector); }
public function __construct($dependencyInjector = null) { parent::__construct($dependencyInjector); ini_set('session.use_cookies', 0); }