<?php
declare(strict_types=1);
namespace Slivki\Entity;
use Slivki\Services\Offer\CustomProductOfferSorter;
class FoodFilterCounter
{
private $ID;
private $entityID;
private $open;
private $recommended;
private $popular;
private $speed;
private $ascPrice;
private $descPrice;
private $priceByKg;
private int $popularDay;
private int $priceByKgDesc;
public function __construct(int $entityID)
{
$this->entityID = $entityID;
$this->popularDay = 0;
$this->priceByKgDesc = 0;
}
public function getID(): int
{
return $this->ID;
}
public function getEntityID(): int
{
return $this->entityID;
}
public function getOpen(): ?int
{
return $this->open;
}
public function getRecommended(): ?int
{
return $this->recommended;
}
public function getPopular(): ?int
{
return $this->popular;
}
public function getSpeed(): ?int
{
return $this->speed;
}
public function getAscPrice(): ?int
{
return $this->ascPrice;
}
public function getDescPrice(): ?int
{
return $this->descPrice;
}
public function getPriceByKg(): ?int
{
return $this->priceByKg;
}
public function getPopularDay(): int
{
return $this->popularDay;
}
public function getPriceByKgDesc(): int
{
return $this->priceByKgDesc;
}
public function increaseDeliverySortFilterStat(string $sort): void
{
switch ($sort) {
case CustomProductOfferSorter::DEFAULT_CUSTOM_PRODUCT_SORT:
$this->increaseRecommended();
break;
case CustomProductOfferSorter::POPULARITY_CUSTOM_PRODUCT_SORT:
$this->increasePopular();
break;
case CustomProductOfferSorter::FAST_CUSTOM_PRODUCT_SORT:
$this->increaseSpeed();
break;
case CustomProductOfferSorter::PRICE_CUSTOM_PRODUCT_SORT:
$this->increaseAscPrice();
break;
case CustomProductOfferSorter::EXPENSIVE_CUSTOM_PRODUCT_SORT:
$this->increaseDescPrice();
break;
case CustomProductOfferSorter::PRICE_CUSTOM_PRODUCT_PRICE_PER_KILOGRAM:
$this->increasePriceByKg();
break;
case CustomProductOfferSorter::OPEN_FILTER:
$this->increaseOpen();
break;
case CustomProductOfferSorter::POPULARITY_DAY_CUSTOM_PRODUCT_SORT:
$this->increasePopularDay();
break;
case CustomProductOfferSorter::PRICE_CUSTOM_PRODUCT_PRICE_PER_KILOGRAM_DESC:
$this->increasePriceByKgDesc();
break;
}
}
private function increaseOpen(): void
{
++$this->open;
}
private function increasePriceByKg(): void
{
++$this->priceByKg;
}
private function increaseDescPrice(): void
{
++$this->descPrice;
}
private function increaseAscPrice(): void
{
++$this->ascPrice;
}
private function increaseSpeed(): void
{
++$this->speed;
}
private function increasePopular(): void
{
++$this->popular;
}
private function increaseRecommended() : void
{
++$this->recommended;
}
private function increasePopularDay(): void
{
++$this->popularDay;
}
private function increasePriceByKgDesc(): void
{
++$this->priceByKgDesc;
}
}