Ejemplo n.º 1
0
 /**
  * @inheritdoc
  *
  * @param array $config
  *
  * @return PromiseInterface
  *
  * @throws InvalidArgumentException
  */
 public function connect(array $config)
 {
     $config = $this->validate($config);
     $this->remit($config);
     $this->manager = new ProcessManager();
     if (isset($config["log"])) {
         $this->manager->setLogPath($config["log"]);
     }
     $this->manager->addTask(new DoormanConnectorTask($config));
     $this->manager->tick();
 }
Ejemplo n.º 2
0
 /**
  * @inheritdoc
  *
  * @return bool
  */
 public function tick()
 {
     if (!empty($this->queuing)) {
         $this->manager->addTask(array_shift($this->queuing));
     }
     if ($this->manager->tick()) {
         return true;
     }
     if (empty($this->waiting)) {
         return false;
     }
     $this->queuing = array_shift($this->waiting);
     return true;
 }