Skip to content

Commit a5b5a36

Browse files
author
Matthias Alt
authored
Merge pull request #1 from solutionDrive/for-morpheus
For morpheus
2 parents 80933b4 + 97067d8 commit a5b5a36

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

spec/Model/MultiStepFlowSpec.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,4 +123,14 @@ function it_can_not_get_step_after_last(
123123

124124
$this->getStepAfter($stepCurrent)->shouldReturn(null);
125125
}
126+
127+
function it_can_get_first_step(
128+
MultiStepInterface $firstStep
129+
) {
130+
$firstStep->getId()->willReturn('first-step');
131+
$firstStep->getSlug()->willReturn('first-step');
132+
$this->addStep($firstStep);
133+
134+
$this->getFirstStep()->shouldReturn($firstStep);
135+
}
126136
}

src/Model/MultiStepFlow.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,13 @@ public function addStep(MultiStepInterface $step): void
104104
$this->steps[$step->getId()] = $step;
105105
$this->stepsBySlug[$step->getSlug()] = $step;
106106
}
107+
108+
public function getFirstStep(): MultiStepInterface
109+
{
110+
if (empty($this->steps)) {
111+
throw new StepNotFoundException();
112+
}
113+
reset($this->steps);
114+
return current($this->steps);
115+
}
107116
}

src/Model/MultiStepFlowInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,6 @@ public function getStepAfter(MultiStepInterface $currentStep): ?MultiStepInterfa
3232
public function getStepBefore(MultiStepInterface $currentStep): ?MultiStepInterface;
3333

3434
public function addStep(MultiStepInterface $step): void;
35+
36+
public function getFirstStep(): MultiStepInterface;
3537
}

src/Resources/config/services.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
services:
22
sd.multistep.step_factory:
3-
class: sd\Morpheus\MultiStepBundle\Factory\MultiStepFactory
3+
class: solutionDrive\MultiStepBundle\Factory\MultiStepFactory
44

55
sd.multistep.flow_factory:
6-
class: sd\Morpheus\MultiStepBundle\Factory\MultiStepFlowFactory
6+
class: solutionDrive\MultiStepBundle\Factory\MultiStepFlowFactory
77
arguments:
88
- "@sd.multistep.step_factory"
99

1010
sd.multistep.flow_registry:
11-
class: sd\Morpheus\MultiStepBundle\Registry\MultiStepFlowRegistry
11+
class: solutionDrive\MultiStepBundle\Registry\MultiStepFlowRegistry
1212
arguments:
1313
- "@sd.multistep.flow_factory"
1414

1515
sd.multistep.controller:
16-
class: sd\Morpheus\MultiStepBundle\Controller\MultiStepController
16+
class: solutionDrive\MultiStepBundle\Controller\MultiStepController
1717
arguments:
1818
- "@sd.multistep.flow_registry"
1919
- "@controller_resolver"

0 commit comments

Comments
 (0)