Ejemplo n.º 1
0
 /**
  * @return bool
  */
 public function areEmpty()
 {
     return !$this->hasRequiredIngredients() && !$this->hasOptionalIngredients() && !$this->hasQuery() && !$this->hasGlassName() && is_null($this->alcoholContentGreaterThan) && is_null($this->alcoholContentLowerThan) && !$this->requiredTaste->isDefined() && !$this->optionalTaste->isDefined();
 }
Ejemplo n.º 2
0
 /**
  * @param $requiredTaste
  * @return array
  */
 private function buildTasteArray(Taste $requiredTaste)
 {
     $tastes = [];
     if ($requiredTaste->isSweet()) {
         $tastes[] = Tastes::SWEET;
     }
     if ($requiredTaste->isBitter()) {
         $tastes[] = Tastes::BITTER;
     }
     if ($requiredTaste->isSour()) {
         $tastes[] = Tastes::SOUR;
     }
     if ($requiredTaste->isSpicy()) {
         $tastes[] = Tastes::SPICY;
     }
     if ($requiredTaste->isSalty()) {
         $tastes[] = Tastes::SALTY;
     }
     return $tastes;
 }
Ejemplo n.º 3
0
 /**
  * @return array
  */
 private function serializeTaste(Taste $taste)
 {
     $tastes = [];
     if ($taste->isSweet()) {
         $tastes[] = Tastes::SWEET;
     }
     if ($taste->isBitter()) {
         $tastes[] = Tastes::BITTER;
     }
     if ($taste->isSour()) {
         $tastes[] = Tastes::SOUR;
     }
     if ($taste->isSpicy()) {
         $tastes[] = Tastes::SPICY;
     }
     if ($taste->isSalty()) {
         $tastes[] = Tastes::SALTY;
     }
     return $tastes;
 }