Example #1
0
 /**
  * @param Step $step
  * @param bool $replaceExistingStep
  */
 public function registerStep(Step $step, $replaceExistingStep = false)
 {
     $identifier = $step->getIdentifier();
     if (preg_match(static::STEP_IDENTIFIER_PATTERN, $identifier) !== 1) {
         throw new \InvalidArgumentException(sprintf('The given step "%s" does not match the step identifier pattern %s.', $identifier, static::STEP_IDENTIFIER_PATTERN), 1437921283);
     }
     if ($replaceExistingStep === false && isset($this->steps[$identifier])) {
         throw new \InvalidArgumentException(sprintf('The given step "%s" was already registered and you did not set the "replaceExistingStep" flag.', $identifier), 1437921270);
     }
     $this->steps[$step->getIdentifier()]['step'] = $step;
 }
Example #2
0
 public function addStep(Step $step)
 {
     $this->steps[$step->getIdentifier()] = $step;
 }