/**
  * @return \VXBase\SessionManagement\Session
  */
 public function getSidSession()
 {
     return $this->container->asSingleton(__METHOD__, function (ApplicationFactory $appFactory, ResourceFactory $resFactory, UserUtils $userFactory, VXBaseFactory $vxBaseFactory) {
         $adapter = new Adapter\SidSession\SidSession(new Adapter\SidSession\DataProvider($resFactory->getOracle(), $resFactory->getRedis(), $userFactory), $userFactory, $vxBaseFactory->getAuthApi(), $appFactory->getRequest());
         $sessionApi = new Session($adapter);
         return $sessionApi;
     });
 }
 /**
  * @return SessionProvider\RedisSessionProvider
  */
 public function getRedisSessionProvider($realm)
 {
     return $this->container->asSingleton(__METHOD__ . $realm, function (ResourceFactory $resFactory) use($realm) {
         $provider = new SessionProvider\RedisSessionProvider($resFactory->getRedis());
         $provider->setRealm($realm);
         return $provider;
     });
 }
 /**
  * @param array $listenerDefinition
  * @return callable
  * @throws \Psr\Log\InvalidArgumentException
  */
 public function getListener(array $listenerDefinition)
 {
     switch (count($listenerDefinition)) {
         case 1:
             $class = $listenerDefinition[0];
             $method = '__invoke';
             $params = [];
             break;
         case 2:
             $class = $listenerDefinition[0];
             $method = $listenerDefinition[1];
             $params = [];
             break;
         case 3:
             $class = $listenerDefinition[0];
             $method = $listenerDefinition[1];
             $params = $listenerDefinition[2];
             break;
         default:
             throw new InvalidArgumentException('Invalid listener definition: ' . var_export($listenerDefinition, true));
     }
     if (!class_exists($class)) {
         throw new InvalidArgumentException('Invalid listener class: ' . $class);
     }
     $listener = $this->container->asSingleton(__METHOD__ . $class, function (VXBaseFactory $VXBaseFactory, ApiFactory $apiFactory, UserUtils $userFactory, MobileServicesFactory $mobileServicesFactory, SessionFactory $sessionFactory) use($class, $method, $params) {
         switch ($class) {
             case DebugListener::class:
                 return new DebugListener($apiFactory->getBoomerApi());
             case StatsEventListener::class:
                 return new StatsEventListener();
             case SessionEventListener::class:
                 return new SessionEventListener($sessionFactory);
             case MobileEventListener::class:
                 return new MobileEventListener($mobileServicesFactory, $userFactory, $VXBaseFactory->getPrivateMailApi(), $this->eventDispatcher);
             default:
                 throw new \RuntimeException('No valid creator for listener: ' . $class);
         }
     });
     return [$listener, $method, $params];
 }
Beispiel #4
0
 /**
  * @param $exchangeName
  * @return AMQPExchange
  */
 public function getExchange($exchangeName)
 {
     return $this->container->asSingleton(__METHOD__ . $exchangeName, function () use($exchangeName) {
         $exchange = null;
         $connection = $this->getConnection(TypeEnum::WRITE);
         if ($connection) {
             if (class_exists('AMQPChannel')) {
                 // AMQP Version 1.0
                 $channel = new AMQPChannel($connection);
                 $exchange = new AMQPExchange($channel);
                 $exchange->setName($exchangeName);
             } else {
                 $exchange = new AMQPExchange($connection, $exchangeName);
             }
         }
         return $exchange;
     });
 }
 /**
  * @return GoogleCloudMessaging
  */
 public function getGoogleCloudMessaging()
 {
     return $this->container->asSingleton(__METHOD__, function () {
         return new GoogleCloudMessaging($this->config['apiKey'], $this->config['debug']);
     });
 }
 /**
  * @return OracleContentPartnerMaster\Adapter
  */
 public function getOracleContentPartnerAdapter()
 {
     return $this->container->asSingleton(__METHOD__, function (ResourceFactory $resFactory, UserUtils $userFactory) {
         return new OracleContentPartnerMaster\Adapter(new OracleContentPartnerMaster\DataProvider($resFactory->getOracle()), $userFactory);
     });
 }
 /**
  * @param Container $container
  */
 public function __construct(Container $container)
 {
     $this->container = $container;
     $container->registerFactory($this);
 }