コード例 #1
0
ファイル: InMemoryRecipes.php プロジェクト: karion/mydrinks
 /**
  * @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;
 }
コード例 #2
0
 /**
  * @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;
     }
 }