Code Duplication    Length = 15-15 lines in 2 locations

src/Pipeline/StepDependencyGraphBuilder.php 2 locations

@@ 61-75 (lines=15) @@
58
     *
59
     * @throws PipelineBuildingException
60
     */
61
    private function addBeforesToDirectedGraph(StepRegistration $currentStep)
62
    {
63
        foreach ($currentStep->getBefores() as $before) {
64
            if (!isset($this->idToStep[$before->getDependsOnId()]) && $before->isEnforced()) {
65
                $allStepIds = implode(',', array_keys($this->idToStep));
66
                throw new PipelineBuildingException(
67
                    "Registration '{$before->getDependsOnId()}' specified in the insertbefore of the '{$currentStep->getStepId()}' step does not exist. Current step ids: $allStepIds."
68
                );
69
            }
70
71
            if (isset($this->idToStep[$before->getDependsOnId()])) {
72
                $this->idDirectedGraph[$before->getDependantId()][] = $before->getDependsOnId();
73
            }
74
        }
75
    }
76
77
    /**
78
     * @param StepRegistration $currentStep
@@ 82-96 (lines=15) @@
79
     *
80
     * @throws PipelineBuildingException
81
     */
82
    private function addAftersToDirectedGraph(StepRegistration $currentStep)
83
    {
84
        foreach ($currentStep->getAfters() as $after) {
85
            if (!isset($this->idToStep[$after->getDependsOnId()]) && $after->isEnforced()) {
86
                $allStepIds = implode(',', array_keys($this->idToStep));
87
                throw new PipelineBuildingException(
88
                    "Registration '{$after->getDependsOnId()}' specified in the insertafter of the '{$currentStep->getStepId()}' step does not exist. Current step ids: $allStepIds."
89
                );
90
            }
91
92
            if (isset($this->idToStep[$after->getDependsOnId()])) {
93
                $this->idDirectedGraph[$after->getDependsOnId()][] = $after->getDependantId();
94
            }
95
        }
96
    }
97
}
98