__construct() public method

public __construct ( boolean $enableSignals = true )
$enableSignals boolean True to enable signal handling, false to disable.
Esempio n. 1
0
 /**
  * @param bool $enableSignals True to enable signal handling, false to disable.
  * @param \Icicle\Loop\Events\EventFactoryInterface|null $eventFactory
  * @param \EventBase|null $base Use null for an EventBase object to be automatically created.
  *
  * @throws \Icicle\Loop\Exception\UnsupportedError If the event extension is not loaded.
  */
 public function __construct(bool $enableSignals = true, EventFactoryInterface $eventFactory = null, EventBase $base = null)
 {
     // @codeCoverageIgnoreStart
     if (!self::enabled()) {
         throw new UnsupportedError(__CLASS__ . ' requires the event extension.');
     }
     // @codeCoverageIgnoreEnd
     $this->base = $base ?: new EventBase();
     parent::__construct($enableSignals, $eventFactory);
 }
Esempio n. 2
0
 /**
  * @param bool $enableSignals True to enable signal handling, false to disable.
  * @param \EvLoop|null $loop Use null for an EvLoop object to be automatically created.
  *
  * @throws \Icicle\Exception\UnsupportedError If the event extension is not loaded.
  */
 public function __construct(bool $enableSignals = true, \EvLoop $loop = null)
 {
     // @codeCoverageIgnoreStart
     if (!self::enabled()) {
         throw new UnsupportedError(__CLASS__ . ' requires the ev extension.');
     }
     // @codeCoverageIgnoreEnd
     $this->loop = $loop ?: new \EvLoop();
     parent::__construct($enableSignals);
 }
Esempio n. 3
0
 /**
  * @param bool $enableSignals True to enable signal handling, false to disable.
  * @param \Icicle\Loop\Events\EventFactoryInterface|null $eventFactory
  * @param \EvLoop|null $loop Use null for an EvLoop object to be automatically created.
  *
  * @throws \Icicle\Loop\Exception\UnsupportedError If the event extension is not loaded.
  */
 public function __construct($enableSignals = true, EventFactoryInterface $eventFactory = null, \EvLoop $loop = null)
 {
     // @codeCoverageIgnoreStart
     if (!extension_loaded('ev')) {
         throw new UnsupportedError(__CLASS__ . ' requires the ev extension.');
     }
     // @codeCoverageIgnoreEnd
     $this->loop = $loop ?: new \EvLoop();
     parent::__construct($enableSignals, $eventFactory);
 }
Esempio n. 4
0
 /**
  * @param bool $enableSignals True to enable signal handling, false to disable.
  * @param resource|null $loop Resource created by uv_loop_new() or null to create a new event loop.
  *
  * @throws \Icicle\Exception\UnsupportedError If the uv extension is not loaded.
  */
 public function __construct(bool $enableSignals = true, $loop = null)
 {
     // @codeCoverageIgnoreStart
     if (!extension_loaded('uv')) {
         throw new UnsupportedError(__CLASS__ . ' requires the UV extension.');
     }
     // @codeCoverageIgnoreEnd
     // @codeCoverageIgnoreStart
     if (!is_resource($loop)) {
         $this->loopHandle = \uv_loop_new();
     } else {
         // @codeCoverageIgnoreEnd
         $this->loopHandle = $loop;
     }
     parent::__construct($enableSignals);
 }
Esempio n. 5
0
 /**
  * @param bool $enableSignals True to enable signal handling, false to disable.
  * @param \Icicle\Loop\Events\EventFactoryInterface|null $eventFactory
  * @param resource|null Resource created by event_base_new() or null to automatically create an event base.
  *
  * @throws \Icicle\Loop\Exception\UnsupportedError If the libevent extension is not loaded.
  */
 public function __construct($enableSignals = true, EventFactoryInterface $eventFactory = null, $base = null)
 {
     // @codeCoverageIgnoreStart
     if (!self::enabled()) {
         throw new UnsupportedError(__CLASS__ . ' requires the libevent extension.');
     }
     // @codeCoverageIgnoreEnd
     // @codeCoverageIgnoreStart
     if (!is_resource($base)) {
         $this->base = event_base_new();
     } else {
         // @codeCoverageIgnoreEnd
         $this->base = $base;
     }
     parent::__construct($enableSignals, $eventFactory);
 }