PHPDaemon\Network\Pool::__construct PHP Method

__construct() public method

Constructor
public __construct ( array $config = [], boolean $init = true )
$config array Config variables
$init boolean
    public function __construct($config = [], $init = true)
    {
        $this->config = $config;
        if ($this->connectionClass === null) {
            $e = explode('\\', get_class($this));
            $e[sizeof($e) - 1] = 'Connection';
            $this->connectionClass = '\\' . implode('\\', $e);
        }
        if ($this->eventLoop === null) {
            $this->eventLoop = EventLoop::$instance;
        }
        $this->onConfigUpdated();
        if ($init) {
            $this->init();
        }
    }

Usage Example

Beispiel #1
0
 /**
  * Constructor
  * @param array   $config Config variables
  * @param boolean $init
  */
 public function __construct($config = [], $init = true)
 {
     parent::__construct($config, false);
     $this->bound = new \PHPDaemon\Structures\ObjectStorage();
     if (isset($this->config->listen)) {
         $this->bindSockets($this->config->listen->value);
     }
     if ($init) {
         $this->init();
     }
 }