Ejemplo n.º 1
0
 /**
  * @param NetworkComponentAwareInterface|null $aware
  * @param NetworkComponentInterface|null $component
  */
 public function __construct(NetworkComponentAwareInterface $aware = null, NetworkComponentInterface $component = null)
 {
     $this->component = $component;
     $this->blacklist = [];
     if ($aware !== null) {
         $aware->setComponent($this);
     }
 }
Ejemplo n.º 2
0
 /**
  * @param NetworkComponentAwareInterface|null $aware
  * @param NetworkComponentInterface|null $component
  */
 public function __construct(NetworkComponentAwareInterface $aware = null, NetworkComponentInterface $component = null)
 {
     $this->httpServer = $component;
     $this->httpDriver = new HttpDriver();
     if ($aware !== null) {
         $aware->setComponent($this);
     }
 }
Ejemplo n.º 3
0
 /**
  * @param NetworkComponentAwareInterface|null $aware
  * @param NetworkComponentInterface|null $component
  */
 public function __construct(NetworkComponentAwareInterface $aware = null, NetworkComponentInterface $component = null)
 {
     $this->wsServer = $component === null ? new NullServer() : $component;
     $this->wsDriver = new WsDriver();
     $this->connCollection = new SplObjectStorage();
     if ($aware !== null) {
         $aware->setComponent($this);
     }
 }
Ejemplo n.º 4
0
 /**
  * @param NetworkComponentAwareInterface $aware
  * @param mixed[] $params
  */
 public function __construct(NetworkComponentAwareInterface $aware = null, $params = [])
 {
     $this->routes = isset($params['routes']) && $params['routes'] instanceof RouteCollection ? $params['routes'] : new RouteCollection();
     $this->context = isset($params['context']) && $params['context'] instanceof RequestContext ? $params['context'] : new RequestContext();
     $this->matcher = new UrlMatcher($this->routes, $this->context);
     $this->host = isset($params['host']) ? $params['host'] : 'localhost';
     $this->checkOrigin = isset($params['checkOrigin']) ? $params['checkOrigin'] : false;
     $this->allowedOrigins = [];
     if ($aware !== null) {
         $aware->setComponent($this);
     }
 }
Ejemplo n.º 5
0
 /**
  * @param NetworkComponentAwareInterface|null $aware
  * @param NetworkComponentInterface|null $component
  * @param SessionHandlerInterface|null $handler
  * @param string[] $options
  * @param HandlerInterface|null $serializer
  * @throws RuntimeException
  */
 public function __construct(NetworkComponentAwareInterface $aware = null, NetworkComponentInterface $component = null, SessionHandlerInterface $handler = null, $options = [], HandlerInterface $serializer = null)
 {
     $this->component = $component;
     $this->handler = $handler !== null ? $handler : new NullSessionHandler();
     $this->nullHandler = new NullSessionHandler();
     ini_set('session.auto_start', 0);
     ini_set('session.cache_limiter', '');
     ini_set('session.use_cookies', 0);
     $this->setOptions($options);
     if ($serializer === null) {
         $serialClass = "\\Ratchet\\Session\\Serialize\\{$this->toClassCase(ini_get('session.serialize_handler'))}Handler";
         if (!class_exists($serialClass)) {
             throw new RuntimeException('Unable to parse session serialize handler.');
         }
         $serializer = new $serialClass();
     }
     $this->serializer = $serializer;
     if ($aware !== null) {
         $aware->setComponent($this);
     }
 }