/**
* Inserts an element into the pipeline at the given position.
*
* @param AbstractPipe $pipe
*
* @return Workflow
*/
protected function addPipe(AbstractPipe $pipe)
{
if ($pipe->getPosition() === self::PREPEND) {
array_unshift($this->pipeline, $pipe);
} else {
$this->pipeline[] = $pipe;
}
return $this;
}