/** * Registers entries with the container. * @param Container $app */ public function register(Container $app) { $app[ResponseInterface::class] = $app->factory(Response::class); $app[ServerRequestInterface::class] = function () use($app) { // Return changed request if available if (isset($app->request)) { return $app->request; } return ServerRequestFactory::fromGlobals(); }; }
public function testInvokeResolutionFailedTypedArgument() { // Expect $this->expectException(ParameterResolutionException::class); // Act $this->app->make(RecursiveIteratorIterator::class); }
/** * @param ContainerInterface $delegate */ public function __construct(ContainerInterface $delegate = null) { // call parent constructor parent::__construct($delegate); // set default application instance $this->set(self::class, $this); $this->set(get_called_class(), $this); // set emitter $this->emitter = $this->factory(SapiEmitter::class); $this->huggables = $this->load($this->huggables); $this->groupHug($this->huggables); }
/** * Registers entries with the container. * @param Container $app */ public function register(Container $app) { // old session $app[Session::class] = $app->make(Session::class); // old config $app[Config::class] = $app->one(Config::class); // old text system $app[Text::class] = $app->once(function (Config $config) use($app) { $args = []; if ($config->configExists('main', 'language_text')) { $args[] = $config->config('language_text'); } return $app->make(Text::class, $args); }); // Old database system $app[Database::class] = $app->one(Database::class); // Default style renderer $app[RendererInterface::class] = $app->one(Page::class); // Global Data $app[GlobalData::class] = new GlobalData($app); }
/** * Registers entries with the container. * @param Container $app */ public function register(Container $app) { $app[DataInterface::class] = $app->factory(Data::class); $app[ConfigInterface::class] = $app->factory(FileConfig::class); }