Pipeline/Pipeline.php
public function start()
    {
        $dispatcher = $this->getDispatcher();
        $sourceEvent = new SourcePipelineEvent();
        $sourceEvent->setContext($this->getContext());
        $dispatcher->dispatch(
            $this->getEventName(self::EVENT_SUFFIX_SOURCE),
            $sourceEvent
        );
        $this->setContext($sourceEvent->getContext());
        $sources = $sourceEvent->getSources();
        $outputs = [];

        $startEvent = new StartPipelineEvent();
        $startEvent->setContext($this->getContext());
        $startEvent->setItemCount($this->countSourceItems($sources));

        $dispatcher->dispatch(
            $this->getEventName(self::EVENT_SUFFIX_START),
            $startEvent
        );
        $this->setContext($startEvent->getContext());

        $count = $this->countSourceItems($sources);

        $this->progressBar && $this->progressBar->setRedrawFrequency($count > 10 ? $count / 10 : 1);
        $this->progressBar && $this->progressBar->start($count);

        foreach ($sources as $source) {
            foreach ($source as $item) {
                $itemEvent = new ItemPipelineEvent($item);
                $itemEvent->setContext($this->getContext());

                $dispatcher->dispatch(
                    $this->getEventName(self::EVENT_SUFFIX_MODIFY),
                    $itemEvent
                );

                $dispatcher->dispatch(
                    $this->getEventName(self::EVENT_SUFFIX_CONSUME),
                    $itemEvent
                );

                $output = $itemEvent->getOutput();
                if ($output !== null) {
                    $outputs[] = $output;
                }

                $this->setContext($itemEvent->getContext());

                $this->progressBar && $this->progressBar->advance();
            }
        }

        $finishEvent = new FinishPipelineEvent();
        $finishEvent->setContext($this->getContext());
        $dispatcher->dispatch(
            $this->getEventName(self::EVENT_SUFFIX_FINISH),
            $finishEvent
        );

        $this->progressBar && $this->progressBar->finish();

        return ['outputs' => $outputs];
    }
public function start()
    {
        $dispatcher = $this->getDispatcher();
        $sourceEvent = new SourcePipelineEvent();
        $sourceEvent->setContext($this->getContext());
        $dispatcher->dispatch(
            $this->getEventName(self::EVENT_SUFFIX_SOURCE),
            $sourceEvent
        );
        $this->setContext($sourceEvent->getContext());
        $sources = $sourceEvent->getSources();
        $outputs = [];

        $startEvent = new StartPipelineEvent();
        $startEvent->setContext($this->getContext());
        $startEvent->setItemCount($this->countSourceItems($sources));

        $dispatcher->dispatch(
            $this->getEventName(self::EVENT_SUFFIX_START),
            $startEvent
        );
        $this->setContext($startEvent->getContext());

        $count = $this->countSourceItems($sources);

        $this->progressBar && $this->progressBar->setRedrawFrequency($count > 10 ? $count / 10 : 1);
        $this->progressBar && $this->progressBar->start($count);

        foreach ($sources as $source) {
            foreach ($source as $item) {
                $itemEvent = new ItemPipelineEvent($item);
                $itemEvent->setContext($this->getContext());

                $dispatcher->dispatch(
                    $this->getEventName(self::EVENT_SUFFIX_MODIFY),
                    $itemEvent
                );

                $dispatcher->dispatch(
                    $this->getEventName(self::EVENT_SUFFIX_CONSUME),
                    $itemEvent
                );

                $output = $itemEvent->getOutput();
                if ($output !== null) {
                    $outputs[] = $output;
                }

                $this->setContext($itemEvent->getContext());

                $this->progressBar && $this->progressBar->advance();
            }
        }

        $finishEvent = new FinishPipelineEvent();
        $finishEvent->setContext($this->getContext());
        $dispatcher->dispatch(
            $this->getEventName(self::EVENT_SUFFIX_FINISH),
            $finishEvent
        );

        $this->progressBar && $this->progressBar->finish();

        return ['outputs' => $outputs];
    }
{@inheritdoc}