Пример #1
0
 /**
  * Process with worker
  *
  * @param string   $type
  * @param \Closure $fn
  */
 public function process($type = null, $fn = null)
 {
     if ($type instanceof \Closure) {
         $fn = $type;
         $type = null;
     }
     if ($fn) {
         $this->on('process:' . ($type ? $type : '*'), $fn);
     }
     $this->emit('process', $type, $fn);
     $worker = new Worker($this, $type);
     $worker->start();
 }