/**
  * @return ObjectDefinition
  */
 protected function getDatabaseManager()
 {
     $manager = new ObjectDefinition(Manager::class);
     foreach ($this->connections as $name => $connection) {
         $manager->addMethodCall('addConnection', $connection, $name);
     }
     $manager->addMethodCall('bootEloquent');
     $manager->addMethodCall('setAsGlobal');
     return $manager;
 }
Ejemplo n.º 2
0
 /**
  * Returns the definition to register in the container.
  *
  * @return DefinitionInterface[]
  */
 public function getDefinitions()
 {
     $manager = new ObjectDefinition(Manager::class);
     foreach ($this->connections as $name => $connection) {
         $manager->addMethodCall('addConnection', $connection, $name);
     }
     $manager->addMethodCall('bootEloquent');
     $manager->addMethodCall('setAsGlobal');
     return [Manager::class => $manager];
 }
 /**
  * Returns the definition to register in the container.
  *
  * @return DefinitionInterface[]
  */
 public function getDefinitions()
 {
     $console = new ObjectDefinition(Application::class);
     $console->addMethodCall('setName', 'Glue');
     $console->addMethodCall('setVersion', Glue::VERSION);
     // Register commands
     foreach ($this->commands as $command) {
         $console->addMethodCall('add', new Reference($command));
     }
     return [Application::class => $console, 'console' => new Reference(Application::class)];
 }
 /**
  * @return ObjectDefinition
  */
 protected function getApplication()
 {
     $console = new ObjectDefinition(Application::class);
     $console->addMethodCall('setName', $this->name);
     $console->addMethodCall('setVersion', $this->version);
     // Register commands
     foreach ($this->commands as $command) {
         $command = is_string($command) ? new Reference($command) : $command;
         $console->addMethodCall('add', $command);
     }
     return $console;
 }
Ejemplo n.º 5
0
 /**
  * @return ObjectDefinition
  */
 protected function getRouter()
 {
     $router = new ObjectDefinition(RouteCollection::class);
     $router->setConstructorArguments($this->container);
     $router->addMethodCall('setStrategy', new Reference(StrategyInterface::class));
     return $router;
 }
Ejemplo n.º 6
0
 /**
  * @return ObjectDefinition
  */
 protected function getLogger()
 {
     $logger = new ObjectDefinition(Logger::class);
     $logger->setConstructorArguments('logs');
     $logger->addMethodCall('pushHandler', new Reference(HandlerInterface::class));
     return $logger;
 }
Ejemplo n.º 7
0
 /**
  * Returns the definition to register in the container.
  *
  * @return DefinitionInterface[]
  */
 public function getDefinitions()
 {
     $handler = new ObjectDefinition(StreamHandler::class);
     $handler->setConstructorArguments($this->path . DS . $this->filename, Logger::WARNING);
     $logger = new ObjectDefinition(Logger::class);
     $logger->setConstructorArguments('glue');
     $logger->addMethodCall('pushHandler', new Reference(HandlerInterface::class));
     return [LoggerInterface::class => $logger, HandlerInterface::class => $handler, 'monolog' => new Reference(LoggerInterface::class)];
 }
 /**
  * {@inheritdoc}
  */
 public function getDefinitions()
 {
     // Cancel if no factories
     if (!is_dir($this->path)) {
         return [];
     }
     $factory = new ObjectDefinition(Factory::class);
     $factory->addMethodCall('loadFactories', $this->path);
     return [Factory::class => $factory];
 }
Ejemplo n.º 9
0
 /**
  * @return ObjectDefinition
  */
 protected function getEnvironment()
 {
     $twig = new ObjectDefinition(Twig_Environment::class);
     $twig->setConstructorArguments(new Reference(Twig_LoaderInterface::class), $this->options);
     foreach ($this->extensions as $extension) {
         $extension = is_string($extension) ? new Reference($extension) : $extension;
         $twig->addMethodCall('addExtension', $extension);
     }
     return $twig;
 }
 /**
  * {@inheritdoc}
  */
 public function getDefinitions()
 {
     $emitter = new ObjectDefinition(Emitter::class);
     foreach ($this->listeners as $event => $listeners) {
         $listeners = (array) $listeners;
         foreach ($listeners as $listener) {
             $emitter->addMethodCall('addListener', $event, $listener);
         }
     }
     return [Emitter::class => $emitter];
 }
Ejemplo n.º 11
0
 /**
  * Returns the definition to register in the container.
  *
  * @return DefinitionInterface[]
  */
 public function getDefinitions()
 {
     $isViewsFolder = is_string($this->views) && is_dir($this->views);
     // Define loader
     $loader = $isViewsFolder ? Twig_Loader_Filesystem::class : Twig_Loader_Array::class;
     $loader = new ObjectDefinition($loader);
     $loader->setConstructorArguments($this->views ?: []);
     $twig = new ObjectDefinition(Twig_Environment::class);
     $twig->setConstructorArguments(new Reference(Twig_LoaderInterface::class), $this->options);
     foreach ($this->extensions as $extension) {
         $twig->addMethodCall('addExtension', new Reference($extension));
     }
     return [Twig_LoaderInterface::class => $loader, Twig_Environment::class => $twig, 'twig' => new Reference(Twig_Environment::class)];
 }
 /**
  * {@inheritdoc}
  */
 public function getDefinitions()
 {
     $locator = new ObjectDefinition(ContainerLocator::class);
     $locator->addMethodCall('setContainer', $this->container);
     return [HandlerLocator::class => $locator];
 }