/**
  * @param StepRegistration $currentStep
  *
  * @throws PipelineBuildingException
  */
 private function addBeforesToDirectedGraph(StepRegistration $currentStep)
 {
     foreach ($currentStep->getBefores() as $before) {
         if (!isset($this->idToStep[$before->getDependsOnId()]) && $before->isEnforced()) {
             $allStepIds = implode(',', array_keys($this->idToStep));
             throw new PipelineBuildingException("Registration '{$before->getDependsOnId()}' specified in the insertbefore of the '{$currentStep->getStepId()}' step does not exist. Current step ids: {$allStepIds}.");
         }
         if (isset($this->idToStep[$before->getDependsOnId()])) {
             $this->idDirectedGraph[$before->getDependantId()][] = $before->getDependsOnId();
         }
     }
 }