/** * @param string $slug * @return null|Recipe */ public function findBySlug($slug) { foreach ($this->recipes as $recipe) { if ($this->slugGenerator->generateFrom($recipe->getName()) === $slug) { return $recipe; } } return null; }
/** * @When I remove first step from the recipe */ public function iRemoveFirstStepFromTheRecipe() { try { $command = new RemoveRecipeStepCommand(); $command->slug = $this->slugGenerator->generateFrom($this->currentRecipeName); $command->number = 1; $this->commandBus->handle($command); } catch (Exception $exception) { $this->lastException = $exception; } }