Example #1
0
 /**
  * @param Pipe $pipe
  * @return Pipeline
  */
 public function pipe(Pipe $pipe)
 {
     if (!$this->input instanceof Pipe) {
         $this->input = $pipe;
     }
     if ($this->output) {
         $pipe->input($this->output);
     }
     $this->output = $pipe;
     return $this;
 }
Example #2
0
 protected function filter()
 {
     while (parent::valid() && !call_user_func($this->callback, parent::current(), parent::key())) {
         parent::next();
     }
 }
Example #3
0
 public function rewind()
 {
     $this->count = 0;
     parent::rewind();
 }
Example #4
0
 public function current()
 {
     return call_user_func($this->callback, parent::current(), parent::key());
 }