Exemplo n.º 1
0
 /**
  * @param IContainer $container
  */
 public function initialize(IContainer $container)
 {
     $container->set([ISwiftMailerManager::class, SwiftMailerManager::class], SwiftMailerManager::class)->singleton();
     $container->set([SwiftMailer::class, Swift_Mailer::class], function (SwiftMailerManager $swiftMailerManager) {
         return $swiftMailerManager->getMailer();
     });
 }
 /**
  * @param IContainer $container
  * @param ErrorHandler $errorHandler
  *
  * @throws \Weew\ErrorHandler\Exceptions\InvalidHandlerType
  */
 public function initialize(IContainer $container, ErrorHandler $errorHandler)
 {
     $container->set([ErrorHandler::class, IErrorHandler::class], $errorHandler);
     $errorHandler->enableErrorHandling();
     $errorHandler->enableExceptionHandling();
     $errorHandler->addErrorHandler([$this, 'handleError']);
     $errorHandler->addExceptionHandler([$this, 'handleException']);
 }
 function it_initializes(IHttpApp $httpApp, IErrorHandler $errorHandler, IContainer $container)
 {
     $httpApp->getDebug()->willReturn(true);
     $errorHandler->addErrorHandler(Argument::any())->shouldBeCalled();
     $errorHandler->addExceptionHandler(Argument::any())->shouldBeCalled();
     $container->set(JsonErrorHandler::class, Argument::type(JsonErrorHandler::class))->shouldBeCalled();
     $this->initialize($httpApp, $errorHandler, $container);
 }
 /**
  * @param IContainer $container
  * @param IMonologErrorHandlerConfig $monologConfig
  * @param IErrorHandler $errorHandler
  * @param IMonologChannelManager $channelManager
  */
 public function initialize(IContainer $container, IMonologErrorHandlerConfig $monologConfig, IErrorHandler $errorHandler, IMonologChannelManager $channelManager)
 {
     $logger = $channelManager->getLogger($monologConfig->getErrorChannelName());
     $monologErrorHandler = new MonologErrorHandler($logger, $errorHandler);
     $monologErrorHandler->enableErrorHandling();
     $monologErrorHandler->enableExceptionHandling();
     $container->set(MonologErrorHandler::class, $monologErrorHandler);
 }
 /**
  * @param IBlackHoleErrorHandlerConfig $config
  * @param IErrorHandler $errorHandler
  * @param IContainer $container
  */
 public function initialize(IBlackHoleErrorHandlerConfig $config, IErrorHandler $errorHandler, IContainer $container)
 {
     if ($config->getEnabled()) {
         $errorHandler = new BlackHoleErrorHandler($errorHandler);
         $errorHandler->enable();
         $container->set(BlackHoleErrorHandler::class, $errorHandler);
     }
 }
 /**
  * @param IApp $app
  * @param IErrorHandler $errorHandler
  * @param IContainer $container
  */
 public function initialize(IApp $app, IErrorHandler $errorHandler, IContainer $container)
 {
     if ($app instanceof IHttpApp && $app->getDebug()) {
         $jsonErrorHandler = new JsonErrorHandler($app, $errorHandler);
         $jsonErrorHandler->enableErrorHandling();
         $jsonErrorHandler->enableExceptionHandling();
         $container->set(JsonErrorHandler::class, $jsonErrorHandler);
     }
 }
Exemplo n.º 7
0
Arquivo: App.php Projeto: weew/app
 /**
  * Start App.
  */
 public function start()
 {
     if ($this->started) {
         return;
     }
     $this->started = true;
     $this->getConfigLoader()->setEnvironment($this->getEnvironment());
     $this->config = $this->getConfigLoader()->load();
     $this->container->set([Config::class, IConfig::class], $this->config);
     $this->config->set('env', $this->getEnvironment());
     $this->config->set('debug', $this->getDebug());
     $this->eventer->dispatch(new ConfigLoadedEvent($this->config));
     $this->kernel->initialize();
     $this->eventer->dispatch(new KernelInitializedEvent($this->kernel));
     $this->kernel->boot();
     $this->eventer->dispatch(new KernelBootedEvent($this->kernel));
     $this->eventer->dispatch(new AppStartedEvent($this));
 }
 function it_enables_error_handling(IBlackHoleErrorHandlerConfig $config, IErrorHandler $errorHandler, IContainer $container)
 {
     $config->getEnabled()->willReturn(true);
     $container->set(BlackHoleErrorHandler::class, Argument::type(BlackHoleErrorHandler::class))->shouldBeCalled();
     $this->initialize($config, $errorHandler, $container);
 }
Exemplo n.º 9
0
 /**
  * @param IContainer $container
  */
 public function initialize(IContainer $container)
 {
     $container->set(IDoctrineConfig::class, DoctrineConfig::class);
     $container->set([EntityManager::class, ObjectManager::class, EntityManagerInterface::class], [$this, 'createEntityManager'])->singleton();
 }
 /**
  * BugsnagErrorHandlerProvider constructor.
  *
  * @param IContainer $container
  */
 public function __construct(IContainer $container)
 {
     $container->set(IBugsnagErrorHandlerConfig::class, BugsnagErrorHandlerConfig::class);
     $container->set(BugsnagErrorHandler::class, [$this, 'createBugsnagErrorHandler'])->singleton();
 }
 /**
  * Share instances in the container.
  */
 protected function shareInstancesInContainer()
 {
     $this->container->set([Router::class, IRouter::class], $this->router);
     $this->container->set([RequestHandler::class, IRequestHandler::class], $this->requestHandler);
 }
Exemplo n.º 12
0
 /**
  * @param IContainer $container
  * @param MonologChannelManager $channelManager
  */
 public function initialize(IContainer $container, MonologChannelManager $channelManager)
 {
     $container->set([LoggerInterface::class, Logger::class], $channelManager->getLogger());
     $container->set([IMonologChannelManager::class, MonologChannelManager::class], $channelManager);
 }
Exemplo n.º 13
0
 /**
  * @param IContainer $container
  */
 public function initialize(IContainer $container)
 {
     $container->set([TwigLoader::class, Twig_Loader_Filesystem::class], [$this, 'createTwigLoaderFilesystem'])->singleton();
     $container->set([Twig::class, Twig_Environment::class], [$this, 'createTwigEnvironment'])->singleton();
 }
Exemplo n.º 14
0
 /**
  * @param $providerClass
  * @param IDictionary $shared
  *
  * @return mixed
  */
 public function create($providerClass, IDictionary $shared)
 {
     $provider = $this->container->get($providerClass, ['shared' => $shared]);
     $this->container->set($providerClass, $provider);
     return $provider;
 }
 /**
  * @return mixed
  */
 public function enable()
 {
     $this->container->set($this->repositoryNameParser->getRepositoryNamePattern(), [$this, 'getRepository'])->singleton();
 }