Example #1
0
 public function dispatch($content)
 {
     parent::dispatch($content);
     if ($this->event) {
         $this->event->fire('http.pipeline:dispatch');
     }
     return $this;
 }
Example #2
0
 public function dispatch($content)
 {
     foreach ($this->sections as $section) {
         if ($this->closed) {
             break;
         }
         if (is_callable($section)) {
             if (null !== ($generator = call_user_func_array($section, [$content, $this]))) {
                 if (is_object($generator) && $generator instanceof Generator) {
                     /** @var \Generator $generator */
                     while ($generator->valid()) {
                         if (null !== ($res = $generator->current())) {
                             $content = $res;
                         }
                         $generator->send($content);
                     }
                     if (null !== ($res = $generator->getReturn())) {
                         $content = $res;
                     }
                 } else {
                     $content = $generator;
                 }
             }
         }
     }
     $this->end = $content;
     if (!$this->closed && $this->next) {
         foreach ($this->data as $item => $value) {
             $this->next->bind($item, $value);
         }
         $this->next->open();
         $this->next->dispatch($content);
         $this->next->close();
     }
     return $this;
 }
Example #3
0
 public function onAppend()
 {
     $this->bind->send();
 }
Example #4
0
 public function setPipeline(Pipeline $pipeline)
 {
     $this->pipeline = $pipeline;
     $this->pipeline->bind('server', $pipeline);
 }