/** * @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; }
/** * @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; }