src/Entity/Offer.php line 32

Open in your IDE?
  1. <?php
  2. namespace Slivki\Entity;
  3. use DateTime;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use JsonSerializable;
  7. use Doctrine\Common\Collections\Criteria;
  8. use Slivki\Entity\Media\GiftCertificatePdfBgMedia;
  9. use Slivki\Entity\Media\OfferAppTeaserMedia;
  10. use Slivki\Entity\Media\OfferDeliveryZoneMedia;
  11. use Slivki\Entity\Media\OfferMailingTeaserMedia;
  12. use Slivki\Entity\Media\OfferMapLogoMedia;
  13. use Slivki\Entity\Media\OfferMobileTeaserMedia;
  14. use Slivki\Entity\Media\OfferTeaserMedia;
  15. use Slivki\Entity\Media\OfferTopBlockMedia;
  16. use Slivki\Entity\Media\OfferTopBlockMobileMedia;
  17. use Slivki\Entity\Media\OnlineOrderPopupLogoMedia;
  18. use Slivki\Enum\Offer\OfferOnlineOrderDevice;
  19. use Slivki\Enum\Offer\OfferOnlineOrderType;
  20. use Slivki\Enum\Offer\OfferStatus;
  21. use Slivki\Enum\Order\PaymentType;
  22. use Slivki\Util\CommonUtil;
  23. use Slivki\Util\Iiko\Dominos;
  24. use function array_key_exists;
  25. use function array_map;
  26. use function in_array;
  27. use function count;
  28. class Offer extends Entity implements JsonSerializable
  29. {
  30.     public const DEFAULT_VIBER '+375295084444';
  31.     public const DEFAULT_TELEGRAM 'slivkislivkiby';
  32.     const TEASER_MEDIA_TYPE "bsns-market-action-teaser-media";
  33.     const TEASER_MEDIA_PATH "/public/znijki-media/initial/default/1009921/";
  34.     const DETAIL_MEDIA_PATH "/public/znijki-media/initial/default/1009921/";
  35.     const SHOP_MEDIA_PATH "/public/znijki-media/initial/default/1009921/";
  36.     const SUPPLIER_MEDIA_PATH "/public/znijki-media/initial/default/1009921/";
  37.     const DESCRIPTION_IMAGES_PATH '/public/ximage/';
  38.     const PETROL_OFFER_ID 142938;
  39.     public const DREAMLAND_OFFER_ID 141563;
  40.     public const DREAMLAND_NEW_OFFER_ID 281797;
  41.     public const WHITE_LOTUS_OFFER_ID 141075;
  42.     public const OBLAKA_SALON_OFFER_ID 139498;
  43.     public const OBLAKA_ULTRASOUND_OFFER_ID 279947;
  44.     public const BLACK_START_BURGER_OFFER_ID 283384;
  45.     public const DOMINOS 168243;
  46.     public const JASMIN_OFFER_ID 247462;
  47.     public const TEST_CERTIFICATE_OFFER_ID 286127;
  48.     const FITNESS_WORLD_OFFER_ID 141207;
  49.     const KFC_OFFER_ID 239232;
  50.     const CAR_SHARING_OFFER_ID 275103;
  51.     const BOOKING_OFFER_ID 275216;
  52.     const SUSHI_HOUSE_OFFER_ID 131201;
  53.     const FREESTYLE_OFFER_ID 137760;
  54.     const HEROPARK_OFFER_ID 142436;
  55.     const TYPE_DEFAULT 0;
  56.     const TYPE_ONLINE_ORDER 1;
  57.     const TYPE_TRIPLE 2;
  58.     const TYPE_ONLINE_ORDER_ONLY 3;
  59.     const TYPE_TIRE 4;
  60.     const TYPE_GIFT_CERTIFICATE 5;
  61.     const TYPE_GIFT_CERTIFICATE_DISABLE_CODE 6;
  62.     const TYPE_DOMINOS 7;
  63.     const TYPE_FREE_PER_DAY 8;
  64.     const BEAUTY_OFFERS = [self::OBLAKA_SALON_OFFER_IDself::OBLAKA_ULTRASOUND_OFFER_ID132400239378245043138907132242138583142192,
  65.         243406135251132690139305141075self::JASMIN_OFFER_IDself::ZHAN_CHAI_OFFER_ID]; // Марсель, Белый лотос.
  66.     const SOSEDI_OFFER_ID 283793;
  67.     const MARSEL_OFFER_ID 141075;
  68.     public const FREESTYLE_CERTIFICATE_OFFER_ID 283213;
  69.     public const FREESTYLE_FLOATING_CERTIFICATE_OFFER_ID 137906;
  70.     public const FREESTYLE_OFFER_IDS = [
  71.         self::FREESTYLE_CERTIFICATE_OFFER_ID,
  72.         self::FREESTYLE_FLOATING_CERTIFICATE_OFFER_ID,
  73.         138755,
  74.         136284,
  75.         296373,
  76.     ];
  77.     public const MINSK_WORLD_CERTIFICATE_OFFER_ID 288763;
  78.     public const FREESTYLE_CERTIFICATE_START_QR_CODES_DATE '2021-03-25';
  79.     public const YANDEX_ALISA_OFFER_ID 290406;
  80.     public const SMART_GOODS_OFFER_ID 290491;
  81.     public const TL24_OFFER_ID 291548;
  82.     public const ROYAL_PLAZA_EVENTS_OFFER_ID 290238;
  83.     public const ROYAL_PLAZA_PSYCHOLOGIST_OFFER_ID 291114;
  84.     public const IZUMI_OFFER_ID 141144;
  85.     public const OUSHEN_OFFER_ID 289105;
  86.     public const OUSHEN2_OFFER_ID 296944;
  87.     public const PLANETA_OFFER_ID 135977;
  88.     public const IDEALMED_OFFER_ID 141086;
  89.     public const PONPUSHKA_OFFER_ID 292879;
  90.     public const MARSEL_MASSAGE_OFFER_ID 140351;
  91.     public const BETERA_OFFER_ID 288763;
  92.     public const BETERA_SALE_NEWS_ID 296012;
  93.     public const ZHAN_CHAI_OFFER_ID 295525;
  94.     public const MEGASUN_OFFER_ID 282591;
  95.     public const MEGASUN_2_OFFER_ID 283587;
  96.     protected $creator;
  97.     protected $title;
  98.     protected ?string $meOnMapName null;
  99.     protected $explanationText;
  100.     protected $regularPrice;
  101.     protected $offerPrice;
  102.     protected $price;
  103.     protected $oldPrice;
  104.     protected $discount;
  105.     protected $activeSince;
  106.     protected $activeTill;
  107.     protected $codeActiveTill;
  108.     protected $active;
  109.     protected $hidden;
  110.     protected $paid;
  111.     protected $free;
  112.     // TODO: null is temporary while cache reloaded
  113.     protected ?bool $withoutCodes;
  114.     protected $showPriceInConditions;
  115.     protected $additionalPercents;
  116.     protected $showAltOffers;
  117.     protected $showCurrencies;
  118.     protected $address;
  119.     protected $searchPosition;
  120.     protected $activeSearchPosition;
  121.     protected $categories;
  122.     protected $medias;
  123.     protected $seo;
  124.     /**
  125.      * @var iterable<EntityDescription>|null
  126.      */
  127.     protected ?iterable $descriptions;
  128.     protected $teaserMedias;
  129.     protected $mobileTeaserMedias;
  130.     protected $appTeaserMedias;
  131.     protected $topBlockMedias;
  132.     protected $topBlockMobileMedias;
  133.     protected $mailingTeaserMedias;
  134.     protected Collection $onlineOrderPopupLogoMedias;
  135.     protected $hotFeedIconMedia;
  136.     protected $detailMeidas;
  137.     protected $shopMedias;
  138.     protected $offerCodePools;
  139.     protected $offerOrders;
  140.     protected ?int $lastCodePoolStartPurchaseCount null;
  141.     protected $usedCodesCount;
  142.     protected $geoLocations;
  143.     protected $phoneNumbers;
  144.     protected $directors;
  145.     protected $directorID;
  146.     protected $captionName;
  147.     protected $captionColor;
  148.     protected $activeCurrencyCalculator;
  149.     protected $bankCurrency;
  150.     protected $bankCurrencyID;
  151.     protected $luceneReindex;
  152.     protected $codeCost;
  153.     protected $codeCostByCount;
  154.     protected $rating;
  155.     protected $lastModified;
  156.     protected $manager;
  157.     protected $defaultCategoryID;
  158.     protected $companyName;
  159.     protected $giftCertificates;
  160.     protected $hint;
  161.     protected $review;
  162.     protected $onReview;
  163.     protected $renewedOn;
  164.     protected $defaultCity;
  165.     protected $teaserLogoWidth;
  166.     protected $teaserLogoHeight;
  167.     protected $hideNoveltyLabel;
  168.     protected $hideBannersInComments;
  169.     protected $extensions;
  170.     protected $sumForFreeDelivery;
  171.     protected $deliveryPrice;
  172.     protected $antitags;
  173.     protected $createdOn;
  174.     protected $allowedBuyOnlyCode;
  175.     protected $buyCodeButtonText;
  176.     protected $buyItemsButtonText;
  177.     protected $freeCodesCount;
  178.     protected $reservedCodesCount;
  179.     protected $shareClick;
  180.     protected $inFreeCategory;
  181.     protected $fakeFreeCodesCount;
  182.     protected $categoriIDs;
  183.     protected $purchaseKoeff;
  184.     protected $giftCertificateOffer;
  185.     protected $supplierPhotoMedias;
  186.     protected $version;
  187.     protected $supplierCategoryData;
  188.     protected $telegramBotShow;
  189.     protected $telegramBotPosition;
  190.     protected $onlineOrderAllowed;
  191.     protected $mobileAppOnlineOrderAllowed;
  192.     protected $buyCodeDisable;
  193.     private $phoneCoverClick;
  194.     private $productFastDelivery;
  195.     private $brandboxEnabled;
  196.     private $offerDeliveryZone;
  197.     private $offerFoodDeliveryZone;
  198.     protected $hideInApp;
  199.     protected ?Collection $onlineOrderSettings;
  200.     protected $giftCertificatePdfBgMedias;
  201.     protected Collection $mapLogoMedias;
  202.     protected Collection $deliveryZoneMedias;
  203.     private $discountDeliveryPopup;
  204.     private $discountPickupPopup;
  205.     private $externalOfferLink;
  206.     private $isShowExternalOfferLink;
  207.     protected $hideFeatures;
  208.     private $deliveryTimeTeaser null;
  209.     private ?\DateTimeImmutable $onlineOrderAllowedRemovedAt null;
  210.     private ?string $regionalCaptionName null;
  211.     private ?string $regionalCaptionColor null;
  212.     private ?string $foodcourtInfoTeaser null;
  213.     private ?string $foodcourtInfoColorTeaser null;
  214.     private bool $isIncludedInBeauty false;
  215.     private bool $qrCodes false;
  216.     private bool $recurrentDisabled false;
  217.     private bool $availableOnFood false;
  218.     private bool $onlineAutoOpened false;
  219.     private bool $foodcourtLogoEnabled false;
  220.     private bool $onlineOrderGiftEnabled false;
  221.     private bool $buyCodeInAppOnly false;
  222.     private bool $showProductsInOfferDescription false;
  223.     private bool $checkAddressInOfferMenu false;
  224.     private bool $showMapIconInApp true;
  225.     private ?array $allowedOnlineOrderTypes null;
  226.     private string $titleFontColor '#000000';
  227.     private bool $separateTabForCertificatesInApp true;
  228.     private ?float $mapPrice null;
  229.     private ?int $mapRating null;
  230.     private ?int $defaultCityId null;
  231.     private ?string $directorName null;
  232.     private ?string $telegram null;
  233.     private ?string $viber null;
  234.     private ?string $messengerCallBack null;
  235.     private ?string $partnerOnlineRegistrationLink null;
  236.     private bool $partnerOnlineRegistrationAllowed false;
  237.     private ?string $yclientAppKey null;
  238.     private ?string $yclientCompanyId null;
  239.     private ?array $allowedPaymentMethodsForCertificate null;
  240.     private bool $festOffer false;
  241.     public function __construct()
  242.     {
  243.         $this->productFastDelivery = new ArrayCollection();
  244.         $this->offerDeliveryZone = new ArrayCollection();
  245.         $this->offerFoodDeliveryZone = new ArrayCollection();
  246.         $this->categories = new ArrayCollection();
  247.         $this->medias = new ArrayCollection();
  248.         $this->descriptions = new ArrayCollection();
  249.         $this->detailMeidas = [];
  250.         $this->shopMedias = [];
  251.         $this->supplierPhotoMedias = new ArrayCollection();
  252.         $this->offerCodePools = new ArrayCollection();
  253.         $this->geoLocations = new ArrayCollection();
  254.         $this->phoneNumbers = new ArrayCollection();
  255.         $this->directors = new ArrayCollection();
  256.         $this->giftCertificates = new ArrayCollection();
  257.         $this->extensions = new ArrayCollection();
  258.         $this->antitags = new ArrayCollection();
  259.         $this->createdOn = new DateTime();
  260.         $this->renewedOn = new DateTime();
  261.         $this->categoriIDs = [];
  262.         $this->version 0;
  263.         $this->teaserMedias = new ArrayCollection();
  264.         $this->mobileTeaserMedias = new ArrayCollection();
  265.         $this->appTeaserMedias = new ArrayCollection();
  266.         $this->giftCertificatePdfBgMedias = new ArrayCollection();
  267.         $this->mapLogoMedias = new ArrayCollection();
  268.         $this->deliveryZoneMedias = new ArrayCollection();
  269.         $this->mailingTeaserMedias = new ArrayCollection();
  270.         $this->topBlockMedias = new ArrayCollection();
  271.         $this->topBlockMobileMedias = new ArrayCollection();
  272.         $this->onlineOrderPopupLogoMedias = new ArrayCollection();
  273.         $this->onlineOrderSettings = new ArrayCollection();
  274.         $this->rating 0;
  275.     }
  276.     public function getPrice() {
  277.         return $this->price;
  278.     }
  279.     public function setPrice($price) {
  280.         $this->price $price;
  281.     }
  282.     public function getOldPrice() {
  283.         return $this->oldPrice;
  284.     }
  285.     public function setOldPrice($oldPrice) {
  286.         $this->oldPrice $oldPrice;
  287.     }
  288.     /**
  289.      * @return User
  290.      */
  291.     public function getCreator() {
  292.         return $this->creator;
  293.     }
  294.     public function setCreator(User $creator) {
  295.         $this->creator $creator;
  296.     }
  297.     public function getLastModified() {
  298.         return $this->lastModified;
  299.     }
  300.     public function setLastModified($lastModified) {
  301.         $this->lastModified $lastModified;
  302.     }
  303.     public function addCategory(Category $category) {
  304.         if (!$this->categories->contains($category)) {
  305.             $this->categories->add($category);
  306.             if ($category->getID() == Category::NEW_OFFER_CATEGORY_ID) {
  307.                 $this->renewedOn = new \DateTime();
  308.             }
  309.             return true;
  310.         }
  311.         return false;
  312.     }
  313.     public function removeCategory(Category $category) {
  314.         $this->categories->removeElement($category);
  315.     }
  316.     public function hasCategory($categoryID) {
  317.         if ($this->categoriIDs && count($this->categoriIDs) > 0) {
  318.             foreach ($this->categoriIDs as $id) {
  319.                 if ($categoryID == $id) {
  320.                     return true;
  321.                 }
  322.             }
  323.             return false;
  324.         }
  325.         foreach ($this->categories as $categoryItem) {
  326.             if ($categoryID == $categoryItem->getID()) {
  327.                 return true;
  328.             }
  329.         }
  330.         return false;
  331.     }
  332.     public function hasCategoryType($categoryTypeID) {
  333.         foreach ($this->categories as $categoryItem) {
  334.             if ($categoryTypeID == $categoryItem->getTypeID()) {
  335.                 return true;
  336.             }
  337.         }
  338.         return false;
  339.     }
  340.     public function hasNotDefaultCityCategory() {
  341.         foreach ($this->categories as $category) {
  342.             if ($category->getCity() and $category->getCity()->getID() != City::DEFAULT_CITY_ID) {
  343.                 return true;
  344.             }
  345.         }
  346.         return false;
  347.     }
  348.     public function addDescription(EntityDescription $description) {
  349.         if (!$this->descriptions->contains($description)) {
  350.             $this->descriptions->add($description);
  351.         }
  352.     }
  353.     public function getTitle() {
  354.         return $this->title;
  355.     }
  356.     public function setTitle($title) {
  357.         $this->title $title;
  358.     }
  359.     public function getMeOnMapName(): ?string
  360.     {
  361.         return $this->meOnMapName;
  362.     }
  363.     public function setMeOnMapName(?string $meOnMapName): void
  364.     {
  365.         $this->meOnMapName $meOnMapName;
  366.     }
  367.     public function getExplanationText() {
  368.         return $this->explanationText;
  369.     }
  370.     public function setExplanationText($explanationText) {
  371.         $this->explanationText $explanationText;
  372.     }
  373.     public function getRegularPrice() {
  374.         $price $this->regularPrice;
  375.         if ($this->isActiveCurrencyCalculator() && is_numeric($price)) {
  376.             $bankCurrency $this->getBankCurrency();
  377.             $price *= $bankCurrency->getRate();
  378.             $price number_format($price0'.'' ') . ' руб.';
  379.         }
  380.         return $price;
  381.     }
  382.     public function getRawRegularPrice() {
  383.         return $this->regularPrice;
  384.     }
  385.     public function setRegularPrice($regularPrice) {
  386.         $this->regularPrice $regularPrice;
  387.     }
  388.     public function getOfferPrice() {
  389.         $price $this->offerPrice;
  390.         if ($this->isActiveCurrencyCalculator() && is_numeric($price)) {
  391.             $bankCurrency $this->getBankCurrency();
  392.             $price *= $bankCurrency->getRate();
  393.             $price number_format($price0'.'' ') . ' руб.';
  394.         }
  395.         return $price;
  396.     }
  397.     public function getRawOfferPrice() {
  398.         return $this->offerPrice;
  399.     }
  400.     public function setOfferPrice($offerPrice) {
  401.         $this->offerPrice $offerPrice;
  402.     }
  403.     public function getDiscount() {
  404.         return $this->discount;
  405.     }
  406.     public function setDiscount($discount) {
  407.         $this->discount $discount;
  408.     }
  409.     public function getHint() {
  410.         return $this->hint;
  411.     }
  412.     public function setHint($hint) {
  413.         $this->hint $hint;
  414.     }
  415.     public function getDiscountLabelText() {
  416.         if (mb_strlen($this->discount) > && is_numeric(mb_substr($this->discount01))) {
  417.             return '-' $this->discount;
  418.         }
  419.         return $this->discount;
  420.     }
  421.     public function getActiveSince() {
  422.         return $this->activeSince;
  423.     }
  424.     public function setActiveSince($activeSince) {
  425.         $this->activeSince $activeSince;
  426.     }
  427.     /**
  428.      * @return \DateTime
  429.      */
  430.     public function getActiveTill()
  431.     {
  432.         return $this->activeTill;
  433.     }
  434.     public function setActiveTill($activeTill) {
  435.         $this->activeTill $activeTill;
  436.     }
  437.     public function getCodeActiveTill() {
  438.         return $this->codeActiveTill;
  439.     }
  440.     public function setCodeActiveTill($codeActiveTill) {
  441.         $this->codeActiveTill $codeActiveTill;
  442.     }
  443.     public function isActive() {
  444.         return $this->active;
  445.     }
  446.     public function setActive($active) {
  447.         $this->active $active;
  448.     }
  449.     public function isHidden() {
  450.         return $this->hidden;
  451.     }
  452.     public function setHidden($hidden) {
  453.         $this->hidden $hidden;
  454.     }
  455.     public function isPaid() {
  456.         return $this->paid;
  457.     }
  458.     public function setPaid($paid) {
  459.         $this->paid $paid;
  460.     }
  461.     public function isFree() {
  462.         return $this->free;
  463.     }
  464.     public function setFree($free) {
  465.         $this->free $free;
  466.     }
  467.     public function getCaptionName() {
  468.         return $this->captionName;
  469.     }
  470.     public function setCaptionName($captionName) {
  471.         $this->captionName $captionName;
  472.     }
  473.     public function getCaptionColor() {
  474.         return $this->captionColor;
  475.     }
  476.     public function setCaptionColor($captionColor) {
  477.         $this->captionColor $captionColor;
  478.     }
  479.     public function getRegionalCaptionName(): ?string
  480.     {
  481.         return $this->regionalCaptionName;
  482.     }
  483.     public function setRegionalCaptionName(?string $regionalCaptionName): void
  484.     {
  485.         $this->regionalCaptionName $regionalCaptionName;
  486.     }
  487.     public function getRegionalCaptionColor(): ?string
  488.     {
  489.         return $this->regionalCaptionColor;
  490.     }
  491.     public function setRegionalCaptionColor(?string $regionalCaptionColor): void
  492.     {
  493.         $this->regionalCaptionColor $regionalCaptionColor;
  494.     }
  495.     /**
  496.      * @deprecated
  497.      */
  498.     public function isOnlineOrderAllowed() {
  499.         return $this->onlineOrderAllowed;
  500.     }
  501.     public function setOnlineOrderAllowed($onlineOrderAllowed) {
  502.         $this->onlineOrderAllowed $onlineOrderAllowed;
  503.     }
  504.     public function isMobileAppOnlineOrderAllowed() {
  505.         return $this->mobileAppOnlineOrderAllowed;
  506.     }
  507.     public function setMobileAppOnlineOrderAllowed($mobileAppOnlineOrderAllowed) {
  508.         $this->mobileAppOnlineOrderAllowed $mobileAppOnlineOrderAllowed;
  509.     }
  510.     public function getOnlineOrderAllowedRemovedAt(): ?\DateTimeImmutable
  511.     {
  512.         return $this->onlineOrderAllowedRemovedAt;
  513.     }
  514.     public function setOnlineOrderAllowedRemovedAt(?\DateTimeImmutable $onlineOrderAllowedRemovedAt): void
  515.     {
  516.         $this->onlineOrderAllowedRemovedAt $onlineOrderAllowedRemovedAt;
  517.     }
  518.     // TODO: null is temporary while cache reloaded
  519.     public function isWithoutCodes(): ?bool
  520.     {
  521.         return $this->withoutCodes;
  522.     }
  523.     // TODO: null is temporary while cache reloaded
  524.     public function setWithoutCodes(?bool $withoutCodes): void
  525.     {
  526.         $this->withoutCodes = (bool) $withoutCodes;
  527.     }
  528.     public function isShowPriceInConditions() {
  529.         return $this->showPriceInConditions;
  530.     }
  531.     public function setShowPriceInConditions($showPriceInConditions) {
  532.         $this->showPriceInConditions $showPriceInConditions;
  533.     }
  534.     public function isShowAltOffers() {
  535.         return $this->showAltOffers;
  536.     }
  537.     public function setShowAltOffers($showAltOffers) {
  538.         $this->showAltOffers $showAltOffers;
  539.     }
  540.     public function isActiveCurrencyCalculator() {
  541.         return $this->activeCurrencyCalculator;
  542.     }
  543.     public function setActiveCurrencyCalculator($activeCurrencyCalculator) {
  544.         $this->activeCurrencyCalculator $activeCurrencyCalculator;
  545.     }
  546.     public function getBankCurrencyID() {
  547.         return $this->bankCurrencyID;
  548.     }
  549.     public function setBankCurrencyID($bankCurrencyID) {
  550.         $this->bankCurrencyID $bankCurrencyID;
  551.     }
  552.     public function getPartnerOnlineRegistrationLink(): ?string
  553.     {
  554.         return $this->partnerOnlineRegistrationLink;
  555.     }
  556.     public function setPartnerOnlineRegistrationLink(?string $partnerOnlineRegistrationLink): void
  557.     {
  558.         $this->partnerOnlineRegistrationLink $partnerOnlineRegistrationLink;
  559.     }
  560.     public function isPartnerOnlineRegistrationAllowed(): bool
  561.     {
  562.         return $this->partnerOnlineRegistrationAllowed;
  563.     }
  564.     public function setPartnerOnlineRegistrationAllowed(bool $partnerOnlineRegistrationAllowed): void
  565.     {
  566.         $this->partnerOnlineRegistrationAllowed $partnerOnlineRegistrationAllowed;
  567.     }
  568.     public function getOnlineRegistrationLink(): string
  569.     {
  570.         if ($this->partnerOnlineRegistrationAllowed && $this->partnerOnlineRegistrationLink !== null) {
  571.             return $this->partnerOnlineRegistrationLink;
  572.         }
  573.         return '/online-zapis/' $this->ID;
  574.     }
  575.     /**
  576.      * @return BankCurrency
  577.      */
  578.     public function getBankCurrency() {
  579.         return $this->bankCurrency;
  580.     }
  581.     public function setBankCurrency(BankCurrency $bankCurrency null) {
  582.         $this->bankCurrency $bankCurrency;
  583.     }
  584.     public function getAdditionalPercents() {
  585.         return $this->additionalPercents;
  586.     }
  587.     public function setAdditionalPercents($additionalPercents) {
  588.         $this->additionalPercents $additionalPercents;
  589.     }
  590.     public function getShowCurrencies() {
  591.         return $this->showCurrencies;
  592.     }
  593.     public function setShowCurrencies($showCurrencies) {
  594.         $this->showCurrencies $showCurrencies;
  595.     }
  596.     public function getAddress() {
  597.         return $this->address;
  598.     }
  599.     public function setAddress($address) {
  600.         $this->address $address;
  601.     }
  602.     public function getSearchPosition() {
  603.         return $this->searchPosition;
  604.     }
  605.     public function setSearchPosition($searchPosition) {
  606.         $this->searchPosition $searchPosition;
  607.     }
  608.     public function isActiveSearchPosition() {
  609.         return $this->activeSearchPosition;
  610.     }
  611.     public function setActiveSearchPosition($activeCearchPosition) {
  612.         $this->activeSearchPosition $activeCearchPosition;
  613.     }
  614.     public function getGeoLocations() {
  615.         return $this->geoLocations;
  616.     }
  617.     public function setGeoLocation(ArrayCollection $geoLocations) {
  618.         $this->geoLocations $geoLocations;
  619.     }
  620.     public function getGeoLocationById(int $id): ?GeoLocation
  621.     {
  622.         foreach ($this->geoLocations as $geoLocation) {
  623.             if ($id === $geoLocation->getID()) {
  624.                 return $geoLocation;
  625.             }
  626.         }
  627.         return null;
  628.     }
  629.     public function getGeoLocationsSortedByDistanceToLocation($location) {
  630.         if (!is_array($location)) {
  631.             return $this->geoLocations;
  632.         }
  633.         $iterator $this->getGeoLocations()->getIterator();
  634.         $iterator->uasort(function ($geoLocation1$geoLocation2) use ($location) {
  635.             $distance1 CommonUtil::getDistance($location[0], $location[1], $geoLocation1->getLatitude(), $geoLocation1->getLongitude(), 'K');
  636.             $distance2 CommonUtil::getDistance($location[0], $location[1], $geoLocation2->getLatitude(), $geoLocation2->getLongitude(), 'K');
  637.             return $distance1 $distance2 ? -1;
  638.         });
  639.         return new ArrayCollection(iterator_to_array($iterator));
  640.     }
  641.     public function addGeoLocation(GeoLocation $geoLocation) {
  642.         if (!$this->geoLocations->contains($geoLocation)) {
  643.             $this->geoLocations->add($geoLocation);
  644.         }
  645.     }
  646.     public function addProductFastDelivery(ProductFastDelivery $productFastDelivery)
  647.     {
  648.         if (!$this->productFastDelivery->contains($productFastDelivery)) {
  649.             $productFastDelivery->setOffer($this);
  650.             $this->productFastDelivery->add($productFastDelivery);
  651.         }
  652.     }
  653.     public function addOfferDeliveryZone(OfferDeliveryZone $offerDeliveryZone)
  654.     {
  655.         if (!$this->offerDeliveryZone->contains($offerDeliveryZone)) {
  656.             $offerDeliveryZone->setOffer($this);
  657.             $this->offerDeliveryZone->add($offerDeliveryZone);
  658.         }
  659.     }
  660.     public function getProductFastDelivery() {
  661.         return $this->productFastDelivery;
  662.     }
  663.     public function getPhoneNumbers() {
  664.         return $this->phoneNumbers;
  665.     }
  666.     public function setPhoneNumbers(ArrayCollection $phoneNumbers) {
  667.         $this->phoneNumbers $phoneNumbers;
  668.     }
  669.     public function getPhoneNumbersWithoutGeoLocations() {
  670.         $phoneNumberWithLocationIDList = [];
  671.         foreach ($this->getGeoLocations() as $geoLocation) {
  672.             foreach ($geoLocation->getPhoneNumbers() as $phoneNumber) {
  673.                 $phoneNumberWithLocationIDList[] = $phoneNumber->getID();
  674.             }
  675.         }
  676.         $phoneNumbersWithoutGeoLocations = [];
  677.         foreach ($this->phoneNumbers as $phoneNumber) {
  678.             if (!in_array($phoneNumber->getID(), $phoneNumberWithLocationIDList)) {
  679.                 $phoneNumbersWithoutGeoLocations[] = $phoneNumber;
  680.             }
  681.         }
  682.         return $phoneNumbersWithoutGeoLocations;
  683.     }
  684.     public function addPhoneNumber(PhoneNumber $phoneNumber) {
  685.         if (!$this->phoneNumbers->contains($phoneNumber)) {
  686.             $phoneNumber->setOffer($this);
  687.             $this->phoneNumbers->add($phoneNumber);
  688.             return true;
  689.         }
  690.         return false;
  691.     }
  692.     public function removePhoneNumberByID($phoneNumberID) {
  693.         foreach ($this->phoneNumbers as $phoneNumber) {
  694.             if ($phoneNumber->getID() == $phoneNumberID) {
  695.                 $this->phoneNumbers->removeElement($phoneNumber);
  696.                 $phoneNumber->setOffer(null);
  697.             }
  698.         }
  699.     }
  700.     /**
  701.      * @return \Doctrine\Common\Collections\ArrayCollection
  702.      */
  703.     public function getCategories() {
  704.         return $this->categories;
  705.     }
  706.     public function getCategoriesByType($type) {
  707.         $result = new ArrayCollection();
  708.         foreach ($this->categories as $category) {
  709.             if ($category->getTypeID() == $type) {
  710.                 $result->add($category);
  711.             }
  712.         }
  713.         return $result;
  714.     }
  715.     public function getCategoriesByCity($cityID) {
  716.         $categories = new ArrayCollection();
  717.         foreach ($this->categories as $category) {
  718.             if ($category->getCity()->getID() == $cityID) {
  719.                 $categories->add($category);
  720.             }
  721.         }
  722.         return $categories;
  723.     }
  724.     /**
  725.      * @deprecated
  726.      */
  727.     public function setCategories(ArrayCollection $categories) {
  728.         $this->categories $categories;
  729.     }
  730.     /**
  731.      * @return \Doctrine\Common\Collections\ArrayCollection
  732.      */
  733.     public function getMedias() {
  734.         return $this->medias;
  735.     }
  736.     public function setMedias($medias) {
  737.         $this->medias $medias;
  738.     }
  739.     /**
  740.      * @return \Slivki\Entity\Seo
  741.      */
  742.     public function getSeo() {
  743.         return $this->seo;
  744.     }
  745.     public function setSeo(Seo $seo) {
  746.         $seo->setResourceURL("Slivki:Default:details");
  747.         $this->seo $seo;
  748.     }
  749.     public function setDescriptions($descriptions) {
  750.         $this->descriptions $descriptions;
  751.     }
  752.     public function getDescriptions() {
  753.         return $this->descriptions;
  754.     }
  755.     public function getDescriptionByType($descriptionType) {
  756.         /** @var \Slivki\Entity\EntityDescription $description */
  757.         foreach ($this->descriptions as $description) {
  758.             if ($description->getTypeID() == $descriptionType) {
  759.                 return $description->getDescription();
  760.             }
  761.         }
  762.         return "";
  763.     }
  764.     public function getConditions() {
  765.         return $this->getDescriptionByType(EntityDescription::TYPE_OFFER_CONDITIONS_ID);
  766.     }
  767.     public function getFeatures() {
  768.         return $this->getDescriptionByType(EntityDescription::TYPE_OFFER_FEATURES_ID);
  769.     }
  770.     public function getLocation() {
  771.         return $this->getDescriptionByType(EntityDescription::TYPE_OFFER_LOCATION_ID);
  772.     }
  773.     public function getLogo() {
  774.         return $this->getDescriptionByType(EntityDescription::TYPE_OFFER_LOGO_ID);
  775.     }
  776.     public function getLegal() {
  777.         return $this->getDescriptionByType(EntityDescription::TYPE_OFFER_LEGAL_ID);
  778.     }
  779.     public function getDescriptionList(): array
  780.     {
  781.         return array_filter(
  782.             array(...$this->descriptions),
  783.             static fn (EntityDescription $description): bool => EntityDescription::TYPE_OFFER_DESCRIPTION_ID === $description->getTypeID(),
  784.         );
  785.     }
  786.     public function getCommonWorkingHours() {
  787.         return $this->getDescriptionByType(EntityDescription::TYPE_OFFER_WORKING_HOURS_ID);
  788.     }
  789.     public function addTeaserMedia(OfferTeaserMedia $teaserMedia) {
  790.         if (!$this->teaserMedias->contains($teaserMedia)) {
  791.             $this->teaserMedias->add($teaserMedia);
  792.             $teaserMedia->setOffer($this);
  793.         }
  794.     }
  795.     public function getTeaserMedia(): ?OfferTeaserMedia
  796.     {
  797.         return $this->teaserMedias->count() > $this->teaserMedias->first() : null;
  798.     }
  799.     public function getTeaserMedias() {
  800.         return $this->teaserMedias;
  801.     }
  802.     public function setTeaserMedias(ArrayCollection $medias) {
  803.         $this->teaserMedias $medias;
  804.     }
  805.     public function removeTeaserMedia(OfferTeaserMedia $teaserMedia) {
  806.         $this->teaserMedias->removeElement($teaserMedia);
  807.     }
  808.     public function addMobileTeaserMedia(OfferMobileTeaserMedia $mobileTeaserMedia) {
  809.         if (!$this->mobileTeaserMedias->contains($mobileTeaserMedia)) {
  810.             $this->mobileTeaserMedias->add($mobileTeaserMedia);
  811.             $mobileTeaserMedia->setOffer($this);
  812.         }
  813.     }
  814.     /** @return null|OfferMobileTeaserMedia */
  815.     public function getMobileTeaserMedia() {
  816.         return $this->mobileTeaserMedias->first();
  817.     }
  818.     public function getMobileTeaserMedias() {
  819.         return $this->mobileTeaserMedias;
  820.     }
  821.     public function setMobileTeaserMedias(ArrayCollection $medias) {
  822.         $this->mobileTeaserMedias $medias;
  823.     }
  824.     public function removeMobileTeaserMedia(OfferMobileTeaserMedia $mobileTeaserMedia) {
  825.         $this->mobileTeaserMedias->removeElement($mobileTeaserMedia);
  826.     }
  827.     public function addAppTeaserMedia(OfferAppTeaserMedia $appTeaserMedia) {
  828.         if (!$this->appTeaserMedias->contains($appTeaserMedia)) {
  829.             $this->appTeaserMedias->add($appTeaserMedia);
  830.             $appTeaserMedia->setOffer($this);
  831.         }
  832.     }
  833.     public function getAppTeaserMedia(): ?OfferAppTeaserMedia
  834.     {
  835.         return $this->appTeaserMedias->count() > $this->appTeaserMedias->first() : null;
  836.     }
  837.     public function getAppTeaserMedias() {
  838.         return $this->appTeaserMedias;
  839.     }
  840.     public function setAppTeaserMedias(ArrayCollection $medias) {
  841.         $this->appTeaserMedias $medias;
  842.     }
  843.     public function removeAppTeaserMedia(OfferAppTeaserMedia $appTeaserMedia) {
  844.         $this->appTeaserMedias->removeElement($appTeaserMedia);
  845.     }
  846.     public function addGiftCertificatePdfBgMedia(GiftCertificatePdfBgMedia $giftCertificatePdfBgMedia) {
  847.         if (!$this->giftCertificatePdfBgMedias->contains($giftCertificatePdfBgMedia)) {
  848.             $this->giftCertificatePdfBgMedias->add($giftCertificatePdfBgMedia);
  849.             $giftCertificatePdfBgMedia->setOffer($this);
  850.         }
  851.     }
  852.     /** @return null|GiftCertificatePdfBgMedia */
  853.     public function getGiftCertificatePdfBgMedia() {
  854.         return $this->giftCertificatePdfBgMedias->first();
  855.     }
  856.     public function getGiftCertificatePdfBgMedias() {
  857.         return $this->giftCertificatePdfBgMedias;
  858.     }
  859.     public function setGiftCertificatePdfBgMedias(ArrayCollection $medias) {
  860.         $this->giftCertificatePdfBgMedias $medias;
  861.     }
  862.     public function removeGiftCertificatePdfBgMedia(GiftCertificatePdfBgMedia $giftCertificatePdfBgMedia) {
  863.         $this->giftCertificatePdfBgMedias->removeElement($giftCertificatePdfBgMedia);
  864.     }
  865.     public function getOnlineOrderSettings(): ?OnlineOrderSettings
  866.     {
  867.         return $this->onlineOrderSettings->count() > $this->onlineOrderSettings->first() : null;
  868.     }
  869.     public function setOnlineOrderSettings(OnlineOrderSettings $onlineOrderSettings): void
  870.     {
  871.         $onlineOrderSettings->setOffer($this);
  872.         $this->onlineOrderSettings = new ArrayCollection([$onlineOrderSettings]);
  873.     }
  874.     public function getOnlineOrderSettingsJSON(): ?array
  875.     {
  876.         $onlineOrderSettings $this->getOnlineOrderSettings();
  877.         if ($onlineOrderSettings === null) {
  878.             return null;
  879.         }
  880.         return $onlineOrderSettings->jsonSerialize();
  881.     }
  882.     public function addMapLogoMedia(OfferMapLogoMedia $media): void
  883.     {
  884.         if (!$this->mapLogoMedias->contains($media)) {
  885.             $this->mapLogoMedias->add($media);
  886.             $media->setOffer($this);
  887.         }
  888.     }
  889.     public function getMapLogoMedia(): ?OfferMapLogoMedia
  890.     {
  891.         return $this->mapLogoMedias->count() > $this->mapLogoMedias->first() : null;
  892.     }
  893.     public function getMapLogoMedias(): Collection
  894.     {
  895.         return $this->mapLogoMedias;
  896.     }
  897.     public function setMapLogoMedias(ArrayCollection $mapLogoMedias): void
  898.     {
  899.         $this->mapLogoMedias $mapLogoMedias;
  900.     }
  901.     public function removeMapLogoMedia(OfferMapLogoMedia $media): void
  902.     {
  903.         $this->mapLogoMedias->removeElement($media);
  904.     }
  905.     public function addDeliveryZoneMedia(OfferDeliveryZoneMedia $media): void
  906.     {
  907.         if (!$this->deliveryZoneMedias->contains($media)) {
  908.             $this->deliveryZoneMedias->add($media);
  909.             $media->setOffer($this);
  910.         }
  911.     }
  912.     public function getDeliveryZoneMedia(): ?OfferDeliveryZoneMedia
  913.     {
  914.         return $this->deliveryZoneMedias->count() > $this->deliveryZoneMedias->first() : null;
  915.     }
  916.     public function getDeliveryZoneMedias(): Collection
  917.     {
  918.         return $this->deliveryZoneMedias;
  919.     }
  920.     public function setDeliveryZoneMedias(ArrayCollection $deliveryZoneMedias): void
  921.     {
  922.         $this->deliveryZoneMedias $deliveryZoneMedias;
  923.     }
  924.     public function removeDeliveryZoneMedia(OfferDeliveryZoneMedia $media): void
  925.     {
  926.         $this->deliveryZoneMedias->removeElement($media);
  927.     }
  928.     public function addTopBlockMedia(OfferTopBlockMedia $topBlockMedia) {
  929.         if (!$this->topBlockMedias->contains($topBlockMedia)) {
  930.             $this->topBlockMedias->add($topBlockMedia);
  931.             $topBlockMedia->setOffer($this);
  932.         }
  933.     }
  934.     public function getTopBlockMedia(): ?OfferTopBlockMedia
  935.     {
  936.         return $this->topBlockMedias->count() > $this->topBlockMedias->first() : null;
  937.     }
  938.     public function getTopBlockMedias() {
  939.         return $this->topBlockMedias;
  940.     }
  941.     public function setTopBlockMedias(ArrayCollection $medias) {
  942.         $this->topBlockMedias $medias;
  943.     }
  944.     public function removeTopBlockMedia(OfferTopBlockMedia $topBlockMedia) {
  945.         $this->topBlockMedias->removeElement($topBlockMedia);
  946.     }
  947.     public function addTopBlockMobileMedia(OfferTopBlockMobileMedia $topBlockMobileMedia) {
  948.         if (!$this->topBlockMobileMedias->contains($topBlockMobileMedia)) {
  949.             $this->topBlockMobileMedias->add($topBlockMobileMedia);
  950.             $topBlockMobileMedia->setOffer($this);
  951.         }
  952.     }
  953.     public function getTopBlockMobileMedia(): ?OfferTopBlockMobileMedia
  954.     {
  955.         return $this->topBlockMobileMedias->count() > $this->topBlockMobileMedias->first() : null;
  956.     }
  957.     public function getTopBlockMobileMedias() {
  958.         return $this->topBlockMobileMedias;
  959.     }
  960.     public function setTopBlockMobileMedias(ArrayCollection $medias) {
  961.         $this->topBlockMobileMedias $medias;
  962.     }
  963.     public function removeTopBlockMobileMedia(OfferTopBlockMobileMedia $topBlockMobileMedia) {
  964.         $this->topBlockMobileMedias->removeElement($topBlockMobileMedia);
  965.     }
  966.     public function addOnlineOrderPopupLogoMedia(OnlineOrderPopupLogoMedia $onlineOrderPopupLogoMedia): void
  967.     {
  968.         if (!$this->onlineOrderPopupLogoMedias->contains($onlineOrderPopupLogoMedia)) {
  969.             $this->onlineOrderPopupLogoMedias = new ArrayCollection();
  970.             $this->onlineOrderPopupLogoMedias->add($onlineOrderPopupLogoMedia);
  971.             $onlineOrderPopupLogoMedia->setOffer($this);
  972.         }
  973.     }
  974.     public function getOnlineOrderPopupLogoMedia(): ?OnlineOrderPopupLogoMedia
  975.     {
  976.         return false === $this->onlineOrderPopupLogoMedias->first() ? null $this->onlineOrderPopupLogoMedias->first();
  977.     }
  978.     /**
  979.      * @return Collection<OnlineOrderPopupLogoMedia>
  980.      */
  981.     public function getOnlineOrderPopupLogoMedias(): Collection
  982.     {
  983.         return $this->onlineOrderPopupLogoMedias;
  984.     }
  985.     public function setOnlineOrderPopupLogoMedias(ArrayCollection $medias): void
  986.     {
  987.         $this->onlineOrderPopupLogoMedias $medias;
  988.     }
  989.     public function removeOnlineOrderPopupLogoMedia(OnlineOrderPopupLogoMedia $onlineOrderPopupLogoMedia): void
  990.     {
  991.         $this->topBlockMedias->removeElement($onlineOrderPopupLogoMedia);
  992.     }
  993.     public function addMailingTeaserMedia(OfferMailingTeaserMedia $mailingTeaserMedia null) {
  994.         if (!$this->mailingTeaserMedias->contains($mailingTeaserMedia)) {
  995.             $this->mailingTeaserMedias->add($mailingTeaserMedia);
  996.             $mailingTeaserMedia->setOffer($this);
  997.         }
  998.     }
  999.     /** @return null|OfferMailingTeaserMedia */
  1000.     public function getMailingTeaserMedia() {
  1001.         return $this->mailingTeaserMedias->first();
  1002.     }
  1003.     public function getMailingTeaserMedias() {
  1004.         return $this->mailingTeaserMedias;
  1005.     }
  1006.     public function setMailingTeaserMedias(ArrayCollection $medias) {
  1007.         $this->mailingTeaserMedias $medias;
  1008.     }
  1009.     public function removeMailingTeaserMedia(OfferMailingTeaserMedia $mailingTeaserMedia) {
  1010.         $this->mailingTeaserMedias->removeElement($mailingTeaserMedia);
  1011.     }
  1012.     public function setHotFeedIconMedia(Media $hotFeedIconMedia null) {
  1013.         $this->hotFeedIconMedia $hotFeedIconMedia;
  1014.     }
  1015.     /**
  1016.      * @return null|Media
  1017.      */
  1018.     public function getHotFeedIconMedia() {
  1019.         return $this->hotFeedIconMedia;
  1020.     }
  1021.     public function setDetailMeidas(array $mediaList) {
  1022.         $this->detailMeidas $mediaList;
  1023.     }
  1024.     public function getDetailMedias()
  1025.     {
  1026.         return $this->detailMeidas;
  1027.     }
  1028.     public function setShopMedias(array $mediaList) {
  1029.         $this->shopMedias $mediaList;
  1030.     }
  1031.     public function getShopMedias(): array
  1032.     {
  1033.         return $this->shopMedias ?? [];
  1034.     }
  1035.     public function addShopMedias(Media $media) {
  1036.         if (!$this->shopMedias->contains($media)) {
  1037.             $this->shopMedias->add($media);
  1038.         }
  1039.     }
  1040.     public function setSupplierPhotoMedias(array $mediaList) {
  1041.         $this->supplierPhotoMedias $mediaList;
  1042.     }
  1043.     public function getSupplierPhotoMedias() {
  1044.         return $this->supplierPhotoMedias;
  1045.     }
  1046.     public function getOfferCodePools() {
  1047.         return $this->offerCodePools;
  1048.     }
  1049.     public function setOfferCodePools(ArrayCollection $offerCodePools) {
  1050.         $this->offerCodePools $offerCodePools;
  1051.     }
  1052.     /**
  1053.      * @return bool|OfferCodePool
  1054.      */
  1055.     public function getLastActiveCodePool() {
  1056.         /** @var \Slivki\Entity\OfferCodePool $offerCodePool */
  1057.         foreach ($this->offerCodePools->toArray() as $offerCodePool) {
  1058.             if ($offerCodePool->isActive()) {
  1059.                 return $offerCodePool;
  1060.             }
  1061.         }
  1062.         return false;
  1063.     }
  1064.     public function setCodePool(OfferCodePool $codePool) {
  1065.         if ($this->offerCodePools->count() == 0) {
  1066.             $this->offerCodePools->add($codePool);
  1067.         }
  1068.         foreach ($this->offerCodePools as $key => $pool) {
  1069.             if ($pool->getID() == $codePool->getID()) {
  1070.                 $this->offerCodePools->set($key$codePool);
  1071.             }
  1072.         }
  1073.         $this->usedCodesCount $this->getUsedCodesCount(true);
  1074.         $this->fakeFreeCodesCount $this->getFakeFreeCodesCount(true);
  1075.         $this->freeCodesCount $this->getFreeCodesCount(true);
  1076.         $this->reservedCodesCount $this->getReservedCodesCount(true);
  1077.         $this->setLastCodePoolStartPurchaseCount();
  1078.         $this->lastCodePoolStartPurchaseCount $this->getLastCodePoolStartPurchaseCount();
  1079.     }
  1080.     public function getOfferOrders() {
  1081.         return $this->offerOrders;
  1082.     }
  1083.     public function setOfferOrders(ArrayCollection $offerOrders) {
  1084.         $this->offerOrders $offerOrders;
  1085.     }
  1086.     public function getUsedCodesCount($reload false) {
  1087.         if ($this->usedCodesCount != null && !$reload) {
  1088.             return $this->usedCodesCount;
  1089.         }
  1090.         $lastActiveCodePool $this->getLastActiveCodePool();
  1091.         if (!$lastActiveCodePool) {
  1092.             $this->usedCodesCount 0;
  1093.             return 0;
  1094.         }
  1095.         $usedCodes trim($lastActiveCodePool->getCodesUsed(), "\n");
  1096.         if ($usedCodes == '') {
  1097.             $this->usedCodesCount $lastActiveCodePool->getUsedCodesCountFake();
  1098.             return $this->usedCodesCount;
  1099.         }
  1100.         $this->usedCodesCount count(explode("\n"$usedCodes)) + $lastActiveCodePool->getUsedCodesCountFake();
  1101.         return $this->usedCodesCount;
  1102.     }
  1103.     public function getLastCodePoolStartPurchaseCount(): int
  1104.     {
  1105.         if (null === $this->lastCodePoolStartPurchaseCount) {
  1106.             $this->setLastCodePoolStartPurchaseCount();
  1107.         }
  1108.         return $this->lastCodePoolStartPurchaseCount;
  1109.     }
  1110.     public function setLastCodePoolStartPurchaseCount(): void
  1111.     {
  1112.         $lastActiveCodePool $this->getLastActiveCodePool();
  1113.         if (!$lastActiveCodePool) {
  1114.             $this->lastCodePoolStartPurchaseCount 0;
  1115.             return;
  1116.         }
  1117.         $this->lastCodePoolStartPurchaseCount $lastActiveCodePool->getUsedCodesCountFake();
  1118.     }
  1119.     public function getUsedCodesCountForPastOffer() {
  1120.         $this->usedCodesCount 0;
  1121.         if ($this->offerCodePools->count() > 0) {
  1122.             $codePool $this->offerCodePools->last();
  1123.             if ($codePool) {
  1124.                 $usedCodes trim($codePool->getCodesUsed(), "\n");
  1125.                 if ($usedCodes == '') {
  1126.                     return 0;
  1127.                 }
  1128.                 return count(explode("\n"$usedCodes)) + $codePool->getUsedCodesCountFake();
  1129.             }
  1130.         }
  1131.         return 0;
  1132.     }
  1133.     public function setUsedCodesCount($usedCodesCount) {
  1134.         $this->usedCodesCount $usedCodesCount;
  1135.     }
  1136.     public function getFreeCodesCount($reload false) {
  1137.         if ($this->freeCodesCount != null && !$reload) {
  1138.             return $this->freeCodesCount;
  1139.         }
  1140.         $lastActiveCodePool $this->getLastActiveCodePool();
  1141.         if (!$lastActiveCodePool) {
  1142.             $this->freeCodesCount 0;
  1143.             return 0;
  1144.         }
  1145.         $this->freeCodesCount $lastActiveCodePool->getFreeCodesCount();
  1146.         return $this->freeCodesCount;
  1147.     }
  1148.     public function hasFreeCodes(): bool
  1149.     {
  1150.         return $this->getFreeCodesCount() > 0;
  1151.     }
  1152.     public function getReservedCodesCount($reload false) {
  1153.         if ($this->reservedCodesCount != null && !$reload) {
  1154.             return $this->reservedCodesCount;
  1155.         }
  1156.         $lastActiveCodePool $this->getLastActiveCodePool();
  1157.         if (!$lastActiveCodePool) {
  1158.             $this->reservedCodesCount 0;
  1159.             return 0;
  1160.         }
  1161.         $this->reservedCodesCount $lastActiveCodePool->getReservedCodesCount();
  1162.         return $this->reservedCodesCount;
  1163.     }
  1164.     public function getFakeFreeCodesCount($reload false) {
  1165.         if ($this->fakeFreeCodesCount != null && !$reload) {
  1166.             return $this->fakeFreeCodesCount;
  1167.         }
  1168.         $codePool $this->getLastActiveCodePool();
  1169.         if (!$codePool) {
  1170.             $this->fakeFreeCodesCount 0;
  1171.             return 0;
  1172.         }
  1173.         $this->fakeFreeCodesCount $this->getUsedCodesCount() + $codePool->getFreeCodesCount();
  1174.         return $this->fakeFreeCodesCount;
  1175.     }
  1176.     public function getDirectors() {
  1177.         return $this->directors;
  1178.     }
  1179.     public function findFirstDirector(): ?Director
  1180.     {
  1181.         return false === $this->directors->first() ? null $this->directors->first();
  1182.     }
  1183.     public function getDirectorID() {
  1184.         if ($this->directorID !== null) {
  1185.             return $this->directorID;
  1186.         }
  1187.         if ($this->directors->count()) {
  1188.             $directorID $this->directors->first()->getID();
  1189.             $this->directorID $directorID;
  1190.             return $directorID;
  1191.         }
  1192.         return null;
  1193.     }
  1194.     public function getCodesCountByUser(User $user) {
  1195.         $criteria Criteria::create()->where(Criteria::expr()->eq("user"$user));
  1196.         $offerOrders $this->offerOrders->matching($criteria);
  1197.         $codesCount 0;
  1198.         /** @var OfferOrder $offerOrder */
  1199.         foreach($offerOrders as $offerOrder) {
  1200.             $offerOrderStatus $offerOrder->getStatus();
  1201.             if ($offerOrderStatus == OfferOrder::STATUS_CONFIRM) {
  1202.                 $codesCount += $offerOrder->getCodesCount();
  1203.             }
  1204.         }
  1205.         return $codesCount;
  1206.     }
  1207.     public function isLuceneReindex() {
  1208.         return $this->luceneReindex;
  1209.     }
  1210.     public function setLuceneReindex($luceneReindex) {
  1211.         $this->luceneReindex $luceneReindex;
  1212.     }
  1213.     public function getCodeCost() {
  1214.         return $this->codeCost;
  1215.     }
  1216.     public function setCodeCost($codeCost) {
  1217.         $this->codeCost $codeCost;
  1218.     }
  1219.     public function getCodeCostByCount() {
  1220.         return $this->codeCostByCount;
  1221.     }
  1222.     public function setCodeCostByCount($codeCostByCount) {
  1223.         $this->codeCostByCount $codeCostByCount;
  1224.     }
  1225.     public function isInFreeCodesCategory() {
  1226.         if ($this->inFreeCategory != null) {
  1227.             return $this->inFreeCategory;
  1228.         }
  1229.         foreach ($this->categories as $category) {
  1230.             if ($category->getID() == Category::FREE_CODES_CATEGORY_ID || $category->getTypeID() == Category::FREE_CATEGORY_TYPE) {
  1231.                 $this->inFreeCategory true;
  1232.                 return true;
  1233.             }
  1234.         }
  1235.         $this->inFreeCategory false;
  1236.         return false;
  1237.     }
  1238.     /**
  1239.      * @return boolean
  1240.      */
  1241.     public function isInActivePeriod() {
  1242.         $activeSince $this->getActiveSince();
  1243.         $activeTill $this->getActiveTill();
  1244.         $timeNow = new \DateTime();
  1245.         if(!$activeSince instanceof \DateTime || !$activeTill instanceof \DateTime) {
  1246.             return false;
  1247.         }
  1248.         return $activeSince <= $timeNow && $activeTill $timeNow;
  1249.     }
  1250.     public function isVisible(): bool
  1251.     {
  1252.         return $this->isActive() && $this->isInActivePeriod() && !$this->isHidden();
  1253.     }
  1254.     /**
  1255.      * @return boolean
  1256.      * @deprecated
  1257.      */
  1258.     public function isInVisiblePeriod() {
  1259.         return !$this->hidden;
  1260.     }
  1261.     public function getRating() {
  1262.         return $this->rating;
  1263.     }
  1264.     public function setRating($rating) {
  1265.         $this->rating $rating;
  1266.     }
  1267.     /**
  1268.      * @return User
  1269.      */
  1270.     public function getManager() {
  1271.         return $this->manager;
  1272.     }
  1273.     public function setManager(User $manager) {
  1274.         $this->manager $manager;
  1275.     }
  1276.     public function getDefaultCategoryID() {
  1277.         return $this->defaultCategoryID;
  1278.     }
  1279.     public function setDefaultCategoryID($categoryID) {
  1280.         $this->defaultCategoryID $categoryID;
  1281.     }
  1282.     public function getCompanyName() {
  1283.         return $this->companyName;
  1284.     }
  1285.     public function setCompanyName($companyName) {
  1286.         $this->companyName $companyName;
  1287.     }
  1288.     public function isTelegramBotShow() {
  1289.         return $this->telegramBotShow;
  1290.     }
  1291.     public function setTelegramBotShow($telegramBotShow) {
  1292.         $this->telegramBotShow $telegramBotShow;
  1293.     }
  1294.     public function getTelegramBotPosition() {
  1295.         return $this->telegramBotPosition;
  1296.     }
  1297.     public function setTelegramBotPosition($telegramBotPosition) {
  1298.         $this->telegramBotPosition $telegramBotPosition;
  1299.     }
  1300.     public function getGiftCertificates() {
  1301.         return $this->giftCertificates;
  1302.     }
  1303.     public function getActiveGiftCertificates() {
  1304.         $criteria Criteria::create()->where(Criteria::expr()->eq('active'true))->andWhere(Criteria::expr()->eq('hidden'false));
  1305.         return $this->giftCertificates->matching($criteria);
  1306.     }
  1307.     public function isGiftCertificateOffer() {
  1308.         if ($this->giftCertificateOffer != null) {
  1309.             return $this->giftCertificateOffer;
  1310.         }
  1311.         $this->giftCertificateOffer $this->getActiveGiftCertificates()->count() > 0;
  1312.         return $this->giftCertificateOffer;
  1313.     }
  1314.     public function setGiftCertificates(Collection $giftCertificates) {
  1315.         $this->giftCertificates $giftCertificates;
  1316.     }
  1317.     public function addGiftCertificate(GiftCertificate $giftCertificate) {
  1318.         if (!$this->giftCertificates->contains($giftCertificate)) {
  1319.             $this->giftCertificates->add($giftCertificate);
  1320.             $giftCertificate->setOffer($this);
  1321.         }
  1322.     }
  1323.     public function isNeedReview() {
  1324.         return $this->review;
  1325.     }
  1326.     public function setNeedReview($review) {
  1327.         $this->review $review;
  1328.     }
  1329.     public function isOnReview() {
  1330.         return $this->onReview;
  1331.     }
  1332.     public function setOnReview($onReview) {
  1333.         $this->onReview $onReview;
  1334.     }
  1335.     public function getRenewedOn() {
  1336.         return $this->renewedOn;
  1337.     }
  1338.     public function setRenewedOn(\DateTime $renewedOn) {
  1339.         $this->renewedOn $renewedOn;
  1340.     }
  1341.     /** @return City */
  1342.     public function getDefaultCity() {
  1343.         return $this->defaultCity;
  1344.     }
  1345.     public function setDefaultCity(City $defaultCity) {
  1346.         $this->defaultCity $defaultCity;
  1347.     }
  1348.     public function getDefaultCityId(): ?int
  1349.     {
  1350.         return $this->defaultCityId;
  1351.     }
  1352.     public function setDefaultCityId(?int $defaultCityId): void
  1353.     {
  1354.         $this->defaultCityId $defaultCityId;
  1355.     }
  1356.     public function getTeaserLogoWidth() {
  1357.         return $this->teaserLogoWidth;
  1358.     }
  1359.     public function setTeaserLogoWidth($teaserLogoWidth) {
  1360.         $this->teaserLogoWidth $teaserLogoWidth;
  1361.     }
  1362.     public function getTeaserLogoHeight() {
  1363.         return $this->teaserLogoHeight;
  1364.     }
  1365.     public function setTeaserLogoHeight($teaserLogoHeight) {
  1366.         $this->teaserLogoHeight $teaserLogoHeight;
  1367.     }
  1368.     public function isHideNoveltyLabel() {
  1369.         return $this->hideNoveltyLabel;
  1370.     }
  1371.     public function setHideNoveltyLabel($hideNoveltyLabel) {
  1372.         $this->hideNoveltyLabel $hideNoveltyLabel;
  1373.     }
  1374.     public function isHideBannersInComments() {
  1375.         return $this->hideBannersInComments;
  1376.     }
  1377.     public function setHideBannersInComments($hideBannersInComments) {
  1378.         $this->hideBannersInComments $hideBannersInComments;
  1379.     }
  1380.     public function getExtensions() {
  1381.         return $this->extensions;
  1382.     }
  1383.     public function setExtensions(ArrayCollection $extensions) {
  1384.         $this->extensions $extensions;
  1385.     }
  1386.     /**
  1387.      * @return FoodOfferExtension[]|ArrayCollection
  1388.      */
  1389.     public function getFoodExtensions() {
  1390.         $foodExtensions = new ArrayCollection();
  1391.         if (!$this->extensions) {
  1392.             return $foodExtensions;
  1393.         }
  1394.         foreach ($this->extensions as $extension) {
  1395.             if ($extension instanceof FoodOfferExtension && !$extension instanceof FoodOfferOptionExtension) {
  1396.                 $foodExtensions->add($extension);
  1397.             }
  1398.         }
  1399.         return $foodExtensions;
  1400.     }
  1401.     public function getTireExtensions() {
  1402.         $tireExtensions = new ArrayCollection();
  1403.         foreach ($this->extensions as $extension) {
  1404.             if ($extension instanceof TireOfferExtension) {
  1405.                 $tireExtensions->add($extension);
  1406.             }
  1407.         }
  1408.         return $tireExtensions;
  1409.     }
  1410.     public function getFoodOptionExtensions() {
  1411.         $foodOptionExtensions = new ArrayCollection();
  1412.         foreach ($this->extensions as $extension) {
  1413.             if ($extension instanceof FoodOfferOptionExtension) {
  1414.                 $foodOptionExtensions->add($extension);
  1415.             }
  1416.         }
  1417.         return $foodOptionExtensions;
  1418.     }
  1419.     public function getItems() {
  1420.         $items = new ArrayCollection();
  1421.         if (!$this->extensions) {
  1422.             return $items;
  1423.         }
  1424.         foreach ($this->extensions as $extension) {
  1425.             if ($extension instanceof ItemOfferExtension) {
  1426.                 $items->add($extension);
  1427.             }
  1428.         }
  1429.         return $items;
  1430.     }
  1431.     public function addExtension(OfferExtension $extension) {
  1432.         if (!$this->extensions->contains($extension)) {
  1433.             $this->extensions->add($extension);
  1434.             $extension->setOffer($this);
  1435.         }
  1436.     }
  1437.     public function getSumForFreeDelivery() {
  1438.         return $this->sumForFreeDelivery;
  1439.     }
  1440.     public function setSumForFreeDelivery($sumForFreeDelivery) {
  1441.         $this->sumForFreeDelivery $sumForFreeDelivery;
  1442.     }
  1443.     public function getDeliveryPrice() {
  1444.         return $this->deliveryPrice;
  1445.     }
  1446.     public function setDeliveryPrice($deliveryPrice) {
  1447.         $this->deliveryPrice $deliveryPrice;
  1448.     }
  1449.     /**
  1450.      * @return ArrayCollection
  1451.      */
  1452.     public function getAntiTags() {
  1453.         return $this->antitags;
  1454.     }
  1455.     public function addAntiTag(AntiTag $antitag) {
  1456.         if (!$this->antitags->contains($antitag)) {
  1457.             $antitag->addOffer($this);
  1458.             $this->antitags->add($antitag);
  1459.         }
  1460.     }
  1461.     public function deleteAntiTag(AntiTag $antitag) {
  1462.         $this->antitags->removeElement($antitag);
  1463.     }
  1464.     public function hasAntiTag(AntiTag $antitag) {
  1465.         return $this->antitags->contains($antitag);
  1466.     }
  1467.     public function getCreatedOn() {
  1468.         return $this->createdOn;
  1469.     }
  1470.     public function setCreatedOn($createdOn) {
  1471.         $this->createdOn $createdOn;
  1472.     }
  1473.     public function isAllowedBuyOnlyCode() {
  1474.         return $this->allowedBuyOnlyCode;
  1475.     }
  1476.     public function setAllowedBuyOnlyCode($allowedBuyOnlyCode) {
  1477.         $this->allowedBuyOnlyCode $allowedBuyOnlyCode;
  1478.     }
  1479.     public function getBuyCodeButtonText() {
  1480.         return $this->buyCodeButtonText;
  1481.     }
  1482.     public function setBuyCodeButtonText($buyCodeButtonText) {
  1483.         $this->buyCodeButtonText $buyCodeButtonText;
  1484.     }
  1485.     public function getBuyItemsButtonText() {
  1486.         return $this->buyItemsButtonText;
  1487.     }
  1488.     public function setBuyItemsButtonText($buyItemsButtonText) {
  1489.         $this->buyItemsButtonText $buyItemsButtonText;
  1490.     }
  1491.     public function setShareClick($shareClick) {
  1492.         $this->shareClick $shareClick;
  1493.     }
  1494.     public function getShareClick() {
  1495.         return $this->shareClick;
  1496.     }
  1497.     public function getOfferDeliveryZone(): ?Collection
  1498.     {
  1499.         return $this->offerDeliveryZone;
  1500.     }
  1501.     public function getPurchaseKoeff() {
  1502.         return $this->purchaseKoeff;
  1503.     }
  1504.     public function setPurchaseKoeff($purchaseKoeff) {
  1505.         $this->purchaseKoeff $purchaseKoeff;
  1506.     }
  1507.     public function getVersion() {
  1508.         return $this->version;
  1509.     }
  1510.     public function setVersion($version) {
  1511.         $this->version $version;
  1512.     }
  1513.     public function getSupplierCategoryData() {
  1514.         return $this->supplierCategoryData;
  1515.     }
  1516.     public function setSupplierCategoryData($supplierCategoryData) {
  1517.         $this->supplierCategoryData $supplierCategoryData;
  1518.     }
  1519.     public function isQrCodes(): bool
  1520.     {
  1521.         return $this->qrCodes;
  1522.     }
  1523.     public function setQrCodes(bool $qrCodes): void
  1524.     {
  1525.         $this->qrCodes $qrCodes;
  1526.     }
  1527.     public function isRecurrentDisabled(): bool
  1528.     {
  1529.         return $this->recurrentDisabled;
  1530.     }
  1531.     public function setRecurrentDisabled(bool $recurrentDisabled): void
  1532.     {
  1533.         $this->recurrentDisabled $recurrentDisabled;
  1534.     }
  1535.     public function isAvailableOnFood(): bool
  1536.     {
  1537.         return $this->availableOnFood;
  1538.     }
  1539.     public function setAvailableOnFood(bool $availableOnFood): void
  1540.     {
  1541.         $this->availableOnFood $availableOnFood;
  1542.     }
  1543.     public function getAllowedOnlineOrderTypes(): ?array
  1544.     {
  1545.         return $this->allowedOnlineOrderTypes;
  1546.     }
  1547.     public function setAllowedOnlineOrderTypes(?array $allowedOnlineOrderTypes): void
  1548.     {
  1549.         $this->allowedOnlineOrderTypes $allowedOnlineOrderTypes;
  1550.     }
  1551.     public function getTitleFontColor(): string
  1552.     {
  1553.         return $this->titleFontColor;
  1554.     }
  1555.     public function setTitleFontColor(string $titleFontColor): void
  1556.     {
  1557.         $this->titleFontColor $titleFontColor;
  1558.     }
  1559.     public function getCategoriesIds(): array
  1560.     {
  1561.         $categoryIds = [];
  1562.         foreach ($this->categories as $category) {
  1563.             $categoryIds[] = $category->getID();
  1564.         }
  1565.         return $categoryIds;
  1566.     }
  1567.     public function jsonSerialize(): array
  1568.     {
  1569.         $categoryIDs = [];
  1570.         foreach ($this->categories as $category) {
  1571.             $categoryIDs[] = $category->getID();
  1572.         }
  1573.         return [
  1574.             'ID' => $this->ID,
  1575.             'title' => $this->title,
  1576.             'defaultCityId' => $this->getDefaultCity() !== null $this->getDefaultCity()->getID(): $this->defaultCityId,
  1577.             'meOnMapName' => $this->meOnMapName,
  1578.             'explanationText' => $this->explanationText,
  1579.             'active' => $this->active,
  1580.             'hidden' => $this->hidden,
  1581.             'discount' => $this->discount,
  1582.             'regularPrice' => $this->regularPrice,
  1583.             'offerPrice' => $this->offerPrice,
  1584.             'address' => $this->address,
  1585.             'codeCost' => $this->codeCost,
  1586.             'codeCostByCount' => $this->codeCostByCount,
  1587.             'additionalPercents' => $this->additionalPercents,
  1588.             'showPriceInConditions' => $this->showPriceInConditions,
  1589.             'showAltOffers' => $this->showAltOffers,
  1590.             'free' => $this->free,
  1591.             'captionName' => $this->captionName,
  1592.             'captionColor' => $this->captionColor,
  1593.             'titleFontColor' => $this->titleFontColor,
  1594.             'regionalCaptionName' => $this->regionalCaptionName,
  1595.             'regionalCaptionColor' => $this->regionalCaptionColor,
  1596.             'withoutCodes' => $this->withoutCodes,
  1597.             'activeCurrencyCalculator' => $this->activeCurrencyCalculator,
  1598.             'bankCurrencyID' => $this->bankCurrencyID,
  1599.             'rawRegularPrice' => $this->getRawRegularPrice(),
  1600.             'rawOfferPrice' => $this->getRawOfferPrice(),
  1601.             'activeSearchPosition' => $this->activeSearchPosition,
  1602.             'searchPosition' => $this->searchPosition,
  1603.             'defaultCategoryID' => $this->defaultCategoryID,
  1604.             'companyName' => $this->companyName,
  1605.             'hint' => $this->hint ?: '',
  1606.             'price' => $this->price,
  1607.             'oldPrice' => $this->oldPrice,
  1608.             'teaserLogoWidth' => $this->teaserLogoWidth,
  1609.             'teaserLogoHeight' => $this->teaserLogoHeight,
  1610.             'hideNoveltyLabel' => $this->hideNoveltyLabel,
  1611.             'hideBannersInComments' => $this->hideBannersInComments,
  1612.             'onlineOrderAllowed' => $this->onlineOrderAllowed,
  1613.             'mobileAppOnlineOrderAllowed' => $this->mobileAppOnlineOrderAllowed,
  1614.             'buyCodeDisable' => $this->buyCodeDisable,
  1615.             'hideInApp' => $this->hideInApp,
  1616.             'brandboxEnabled' => $this->brandboxEnabled,
  1617.             'allowedBuyOnlyCode' => $this->allowedBuyOnlyCode,
  1618.             'buyCodeButtonText' => $this->buyCodeButtonText,
  1619.             'buyItemsButtonText' => $this->buyItemsButtonText,
  1620.             'activeSince' => $this->activeSince,
  1621.             'activeTill' => $this->activeTill,
  1622.             'freeCodesCount' => $this->getFreeCodesCount(),
  1623.             'reservedCodesCount' => $this->getReservedCodesCount(),
  1624.             'inFreeCategory' => $this->isInFreeCodesCategory(),
  1625.             'bankCurrency' => $this->bankCurrency,
  1626.             'codeActiveTill' => $this->codeActiveTill,
  1627.             'usedCodesCount' => $this->getUsedCodesCount(),
  1628.             'fakeFreeCodesCount' => $this->getFakeFreeCodesCount(),
  1629.             'lastCodePoolStartPurchaseCount' => $this->getLastCodePoolStartPurchaseCount(),
  1630.             'categoryIDs' => $categoryIDs,
  1631.             'purchaseKoeff' => $this->purchaseKoeff,
  1632.             'giftCertificateOffer' => $this->isGiftCertificateOffer(),
  1633.             'supplierCategoryData' => $this->supplierCategoryData,
  1634.             'telegramBotShow' => $this->telegramBotShow,
  1635.             'discountDeliveryPopup' => $this->getDiscountDeliveryPopup(),
  1636.             'discountPickupPopup' => $this->getDiscountPickupPopup(),
  1637.             'deliveryTimeTeaser' => $this->getDeliveryTimeTeaser(),
  1638.             'foodcourtInfoTeaser' => $this->getFoodcourtInfoTeaser(),
  1639.             'foodcourtInfoColorTeaser' => $this->getFoodcourtInfoColorTeaser(),
  1640.             'externalOfferLink' => $this->getExternalOfferLink(),
  1641.             'isShowExternalOfferLink' => $this->getIsShowExternalOfferLink(),
  1642.             'hideFeatures' => $this->hideFeatures,
  1643.             'isIncludedInBeauty' => $this->isIncludedInBeauty,
  1644.             'qrCodes' =>  $this->qrCodes,
  1645.             'recurrentDisabled' => $this->recurrentDisabled,
  1646.             'availableOnFood' => $this->availableOnFood,
  1647.             'onlineAutoOpened' => $this->onlineAutoOpened,
  1648.             'foodcourtLogoEnabled' => $this->foodcourtLogoEnabled,
  1649.             'onlineOrderGiftEnabled' => $this->onlineOrderGiftEnabled,
  1650.             'onlineOrderSettings' => $this->getOnlineOrderSettingsJSON(),
  1651.             'directorID' => $this->getDirectorID(),
  1652.             'rating' => $this->rating,
  1653.             'buyCodeInAppOnly' => $this->buyCodeInAppOnly,
  1654.             'allowedOnlineOrderTypes' => $this->allowedOnlineOrderTypes,
  1655.             'showProductsInOfferDescription' => $this->showProductsInOfferDescription,
  1656.             'separateTabForCertificatesInApp' => $this->separateTabForCertificatesInApp,
  1657.             'checkAddressInOfferMenu' => $this->checkAddressInOfferMenu,
  1658.             'showMapIconInApp' => $this->showMapIconInApp,
  1659.             'telegram' => $this->telegram,
  1660.             'viber' => $this->viber,
  1661.             'messengerCallBack' => $this->messengerCallBack,
  1662.             'partnerOnlineRegistrationLink' => $this->partnerOnlineRegistrationLink,
  1663.             'partnerOnlineRegistrationAllowed' => $this->partnerOnlineRegistrationAllowed,
  1664.             'yclientAppKey' => $this->yclientAppKey,
  1665.             'yclientCompanyId' => $this->yclientCompanyId,
  1666.             'allowedPaymentMethodsForCertificate' => $this->allowedPaymentMethodsForCertificate,
  1667.             'festOffer' => $this->festOffer,
  1668.         ];
  1669.     }
  1670.     public function fromJSON($data)
  1671.     {
  1672.         $this->freeCodesCount $data->freeCodesCount;
  1673.         $this->reservedCodesCount $data->reservedCodesCount;
  1674.         $this->lastCodePoolStartPurchaseCount $data->lastCodePoolStartPurchaseCount ?? 0;
  1675.         $this->usedCodesCount $data->usedCodesCount;
  1676.         $this->fakeFreeCodesCount $data->fakeFreeCodesCount;
  1677.         $this->inFreeCategory $data->inFreeCategory;
  1678.         $this->activeSince = new \DateTime($data->activeSince->date);
  1679.         $this->activeTill = new \DateTime($data->activeTill->date);
  1680.         $this->codeActiveTill = new \DateTime($data->codeActiveTill->date);
  1681.         if (isset($data->festOffer)) {
  1682.             $this->festOffer $data->festOffer;
  1683.         }
  1684.         if (isset($data->categoryIDs)) {
  1685.             $this->categoriIDs $data->categoryIDs;
  1686.         }
  1687.         if (isset($data->giftCertificateOffer)) {
  1688.             $this->giftCertificateOffer $data->giftCertificateOffer;
  1689.         }
  1690.         if (isset($data->bankCurrency) && isset($data->bankCurrency->ID)) {
  1691.             $bankCurrency = new BankCurrency();
  1692.             $bankCurrency->setID($data->bankCurrency->ID);
  1693.             $bankCurrency->setRate($data->bankCurrency->rate);
  1694.             $bankCurrency->setCurrency($data->bankCurrency->currency);
  1695.             $bankCurrency->setSign($data->bankCurrency->sign);
  1696.             $this->bankCurrency $bankCurrency;
  1697.         }
  1698.         if (isset($data->onlineOrderSettings) && isset($data->onlineOrderSettings->ID)) {
  1699.             $onlineOrderSettings = new OnlineOrderSettings();
  1700.             $onlineOrderSettings->setID($data->onlineOrderSettings->ID);
  1701.             $onlineOrderSettings->setMinDeliverySum($data->onlineOrderSettings->minDeliverySum);
  1702.             $onlineOrderSettings->setMinSumForFreeDelivery($data->onlineOrderSettings->minSumForFreeDelivery);
  1703.             $onlineOrderSettings->setDeliveryPrice($data->onlineOrderSettings->deliveryPrice);
  1704.             $onlineOrderSettings->setPickupEnabled($data->onlineOrderSettings->pickupEnabled);
  1705.             $onlineOrderSettings->setDeliveryEnabled($data->onlineOrderSettings->deliveryEnabled);
  1706.             $onlineOrderSettings->setAllowedPaymentMethods($data->onlineOrderSettings->allowedPaymentMethods);
  1707.             $onlineOrderSettings->setOrderPeriodInDays($data->onlineOrderSettings->orderPeriodInDays);
  1708.             $onlineOrderSettings->setPickupDiscountPercent($data->onlineOrderSettings->pickupDiscountPercent);
  1709.             $onlineOrderSettings->setEmail($data->onlineOrderSettings->email);
  1710.             $onlineOrderSettings->setSplitPayment($data->onlineOrderSettings->splitPayment);
  1711.             $onlineOrderSettings->setDomain($data->onlineOrderSettings->domain);
  1712.             $onlineOrderSettings->setSchedule($data->onlineOrderSettings->schedule);
  1713.             $onlineOrderSettings->setDeliveryTimeFrom($data->onlineOrderSettings->deliveryTimeFrom);
  1714.             $onlineOrderSettings->setDeliveryTimeTill($data->onlineOrderSettings->deliveryTimeTill);
  1715.             $onlineOrderSettings->setDeliverySchedule($data->onlineOrderSettings->deliverySchedule);
  1716.             $onlineOrderSettings->setDeliveryLeadType($data->onlineOrderSettings->deliveryLeadType);
  1717.             $onlineOrderSettings->setDeliveryLeadTime($data->onlineOrderSettings->deliveryLeadTime);
  1718.             $onlineOrderSettings->setDeliveryIntervalBetweenOrdersType($data->onlineOrderSettings->deliveryIntervalBetweenOrdersType);
  1719.             $onlineOrderSettings->setDeliveryIntervalBetweenOrdersTime($data->onlineOrderSettings->deliveryIntervalBetweenOrdersTime);
  1720.             $onlineOrderSettings->setDeliveryDisableType($data->onlineOrderSettings->deliveryDisableType);
  1721.             $onlineOrderSettings->setDeliveryDisableTime($data->onlineOrderSettings->deliveryDisableTime);
  1722.             $onlineOrderSettings->setDeliveryNearlyEnabled($data->onlineOrderSettings->deliveryNearlyEnabled);
  1723.             $onlineOrderSettings->setDeliveryPriceInfo($data->onlineOrderSettings->deliveryPriceInfo ?? null);
  1724.             $onlineOrderSettings->setDeliveryWorkingTime($data->onlineOrderSettings->deliveryWorkingTime ?? null);
  1725.             $onlineOrderSettings->setPickupCookingTime($data->onlineOrderSettings->pickupCookingTime ?? null);
  1726.             $onlineOrderSettings->setPickupLeadTime($data->onlineOrderSettings->pickupLeadTime ?? null);
  1727.             $onlineOrderSettings->setPriceCodeDependsOnOrder($data->onlineOrderSettings->priceCodeDependsOnOrder ?? null);
  1728.             $this->setOnlineOrderSettings($onlineOrderSettings);
  1729.         }
  1730.         if (isset($data->directorID)) {
  1731.             $this->directorID $data->directorID;
  1732.         }
  1733.     }
  1734.     public function isBuyCodeDisable() {
  1735.         return $this->buyCodeDisable;
  1736.     }
  1737.     public function setBuyCodeDisable($buyCodeDisable) {
  1738.         $this->buyCodeDisable $buyCodeDisable;
  1739.     }
  1740.     public function isHideInApp() {
  1741.         return $this->hideInApp;
  1742.     }
  1743.     public function setHideInApp($hideInApp) {
  1744.         $this->hideInApp $hideInApp;
  1745.     }
  1746.     public function getBrandboxEnabled() {
  1747.         return $this->brandboxEnabled;
  1748.     }
  1749.     public function setBrandboxEnabled($brandboxEnabled): void {
  1750.         $this->brandboxEnabled $brandboxEnabled;
  1751.     }
  1752.     public function getDiscountPickupPopup(): ?string
  1753.     {
  1754.         return $this->discountPickupPopup;
  1755.     }
  1756.     public function setDiscountPickupPopup(?string $discountPickupPopup): void
  1757.     {
  1758.         $this->discountPickupPopup $discountPickupPopup;
  1759.     }
  1760.     public function getExternalOfferLink(): ?string
  1761.     {
  1762.         return $this->externalOfferLink;
  1763.     }
  1764.     public function setExternalOfferLink(?string $externalOfferLink): void
  1765.     {
  1766.         $this->externalOfferLink $externalOfferLink;
  1767.     }
  1768.     public function getIsShowExternalOfferLink()
  1769.     {
  1770.         return $this->isShowExternalOfferLink;
  1771.     }
  1772.     public function setIsShowExternalOfferLink($isShowExternalOfferLink): void
  1773.     {
  1774.         $this->isShowExternalOfferLink $isShowExternalOfferLink;
  1775.     }
  1776.     public function getDiscountDeliveryPopup(): ?string
  1777.     {
  1778.         return $this->discountDeliveryPopup;
  1779.     }
  1780.     public function setDiscountDeliveryPopup(?string $discountDeliveryPopup): void
  1781.     {
  1782.         $this->discountDeliveryPopup $discountDeliveryPopup;
  1783.     }
  1784.     public function isFoodOnlineOrderAllowedOnSite(): bool
  1785.     {
  1786.         return $this->isOnlineOrderAllowedByDeviceAndType(
  1787.             OfferOnlineOrderDevice::byValue(OfferOnlineOrderDevice::SITE),
  1788.             OfferOnlineOrderType::byValue(OfferOnlineOrderType::FOOD)
  1789.         );
  1790.     }
  1791.     public function isFoodOnlineOrderAllowedOnApp(): bool
  1792.     {
  1793.         return $this->isOnlineOrderAllowedByDeviceAndType(
  1794.             OfferOnlineOrderDevice::byValue(OfferOnlineOrderDevice::APP),
  1795.             OfferOnlineOrderType::byValue(OfferOnlineOrderType::FOOD)
  1796.         );
  1797.     }
  1798.     public function isGiftCertificateOnlineOrderAllowedOnSite(): bool
  1799.     {
  1800.         return $this->isOnlineOrderAllowedByDeviceAndType(
  1801.             OfferOnlineOrderDevice::byValue(OfferOnlineOrderDevice::SITE),
  1802.             OfferOnlineOrderType::byValue(OfferOnlineOrderType::GIFT_CERTIFICATE)
  1803.         );
  1804.     }
  1805.     public function isGiftCertificateOnlineOrderAllowedOnApp(): bool
  1806.     {
  1807.         return $this->isOnlineOrderAllowedByDeviceAndType(
  1808.             OfferOnlineOrderDevice::byValue(OfferOnlineOrderDevice::APP),
  1809.             OfferOnlineOrderType::byValue(OfferOnlineOrderType::GIFT_CERTIFICATE)
  1810.         );
  1811.     }
  1812.     public function isTireOnlineOrderAllowedOnSite(): bool
  1813.     {
  1814.         return $this->isOnlineOrderAllowedByDeviceAndType(
  1815.             OfferOnlineOrderDevice::byValue(OfferOnlineOrderDevice::SITE),
  1816.             OfferOnlineOrderType::byValue(OfferOnlineOrderType::TIRE)
  1817.         );
  1818.     }
  1819.     public function isTireOnlineOrderAllowedOnApp(): bool
  1820.     {
  1821.         return $this->isOnlineOrderAllowedByDeviceAndType(
  1822.             OfferOnlineOrderDevice::byValue(OfferOnlineOrderDevice::APP),
  1823.             OfferOnlineOrderType::byValue(OfferOnlineOrderType::TIRE)
  1824.         );
  1825.     }
  1826.     public function isOneOfOnlineOrderAllowedOnApp(): bool
  1827.     {
  1828.         if (null === $this->allowedOnlineOrderTypes) {
  1829.             return false;
  1830.         }
  1831.         return \count($this->allowedOnlineOrderTypes[OfferOnlineOrderDevice::APP]) > 0;
  1832.     }
  1833.     public function isOneOfOnlineOrderAllowedOnSite(): bool
  1834.     {
  1835.         if (null === $this->allowedOnlineOrderTypes) {
  1836.             return false;
  1837.         }
  1838.         return \count($this->allowedOnlineOrderTypes[OfferOnlineOrderDevice::SITE]) > 0;
  1839.     }
  1840.     public function getAllowedOnlineOrderTypesOnApp(): ?array
  1841.     {
  1842.         if (null === $this->allowedOnlineOrderTypes || === count($this->allowedOnlineOrderTypes[OfferOnlineOrderDevice::APP])) {
  1843.             return null;
  1844.         }
  1845.         return $this->allowedOnlineOrderTypes[OfferOnlineOrderDevice::APP];
  1846.     }
  1847.     private function isOnlineOrderAllowedByDeviceAndType(OfferOnlineOrderDevice $deviceOfferOnlineOrderType $type): bool
  1848.     {
  1849.         if (null === $this->allowedOnlineOrderTypes) {
  1850.             return false;
  1851.         }
  1852.         return in_array($type->getValue(), $this->allowedOnlineOrderTypes[$device->getValue()], true);
  1853.     }
  1854.     public function getOfferType(bool $isBoughtFreeCode false): int
  1855.     {
  1856.         $offerType self::TYPE_DEFAULT;
  1857.         if (in_array($this->getID(), Dominos::OFFER_IDS_MINSK_AND_REGIONStrue)) {
  1858.             return self::TYPE_DOMINOS;
  1859.         }
  1860.         if ($this->isFoodOnlineOrderAllowedOnApp()) {
  1861.             return $this->isBuyCodeDisable() ? self::TYPE_ONLINE_ORDER_ONLY self::TYPE_ONLINE_ORDER;
  1862.         }
  1863.         if ($this->isGiftCertificateOnlineOrderAllowedOnApp()) {
  1864.             return $this->isBuyCodeDisable() ? self::TYPE_GIFT_CERTIFICATE_DISABLE_CODE self::TYPE_GIFT_CERTIFICATE;
  1865.         }
  1866.         if ($this->getID() === self::PETROL_OFFER_ID) {
  1867.             return self::TYPE_TRIPLE;
  1868.         }
  1869.         if ($this->getTireExtensions()->count() > 0) {
  1870.             return self::TYPE_TIRE;
  1871.         }
  1872.         if (!$isBoughtFreeCode && ($this->isInFreeCodesCategory() || $this->isFree())) {
  1873.             return self::TYPE_FREE_PER_DAY;
  1874.         }
  1875.         return $offerType;
  1876.     }
  1877.     public function isHideFeatures() {
  1878.         return $this->hideFeatures;
  1879.     }
  1880.     public function setHideFeatures($hideFeatures) {
  1881.         $this->hideFeatures $hideFeatures;
  1882.     }
  1883.     public function getFirstGeoLocation(): GeoLocation
  1884.     {
  1885.         return $this->geoLocations->first();
  1886.     }
  1887.     public function getDeliveryTimeTeaser(): ?string
  1888.     {
  1889.         return $this->deliveryTimeTeaser;
  1890.     }
  1891.     public function setDeliveryTimeTeaser(?string $deliveryTimeTeaser): void
  1892.     {
  1893.         $this->deliveryTimeTeaser $deliveryTimeTeaser;
  1894.     }
  1895.     public function isExternalOfferLinkAndShow(): bool
  1896.     {
  1897.         return null !== $this->externalOfferLink && $this->isShowExternalOfferLink;
  1898.     }
  1899.     public function isNotAccess(): bool
  1900.     {
  1901.         return !$this->isActive() || $this->isHidden() || !$this->isInActivePeriod() || $this->isBuyCodeDisable();
  1902.     }
  1903.     public function getFoodcourtInfoTeaser(): ?string
  1904.     {
  1905.         return $this->foodcourtInfoTeaser;
  1906.     }
  1907.     public function setFoodcourtInfoTeaser(?string $foodcourtInfoTeaser): void
  1908.     {
  1909.         $this->foodcourtInfoTeaser $foodcourtInfoTeaser;
  1910.     }
  1911.     public function getFoodcourtInfoColorTeaser(): ?string
  1912.     {
  1913.         return $this->foodcourtInfoColorTeaser;
  1914.     }
  1915.     public function setFoodcourtInfoColorTeaser(?string $foodcourtInfoColorTeaser): void
  1916.     {
  1917.         $this->foodcourtInfoColorTeaser $foodcourtInfoColorTeaser;
  1918.     }
  1919.     public function isIncludedInBeauty(): bool
  1920.     {
  1921.         return $this->isIncludedInBeauty;
  1922.     }
  1923.     public function setIsIncludedInBeauty(bool $isIncludedInBeauty): void
  1924.     {
  1925.         $this->isIncludedInBeauty $isIncludedInBeauty;
  1926.     }
  1927.     public function getStatus(): OfferStatus
  1928.     {
  1929.         return $this->isVisible() ? OfferStatus::byValue(OfferStatus::ACTIVATED) : OfferStatus::byValue(OfferStatus::DEACTIVATED);
  1930.     }
  1931.     public function getCity(): ?City
  1932.     {
  1933.         foreach ($this->categories as $category) {
  1934.             if ($category->getID() === $this->getDefaultCategoryID()) {
  1935.                 return $category->getCity();
  1936.             }
  1937.         }
  1938.         $category $this->categories->first();
  1939.         return false === $category null $category->getCity();
  1940.     }
  1941.     public function isOnlineAutoOpened(): bool
  1942.     {
  1943.         return $this->onlineAutoOpened;
  1944.     }
  1945.     public function setOnlineAutoOpened(bool $onlineAutoOpened): void
  1946.     {
  1947.         $this->onlineAutoOpened $onlineAutoOpened;
  1948.     }
  1949.     public function isFoodcourtLogoEnabled(): bool
  1950.     {
  1951.         return $this->foodcourtLogoEnabled;
  1952.     }
  1953.     public function setFoodcourtLogoEnabled(bool $foodcourtLogoEnabled): void
  1954.     {
  1955.         $this->foodcourtLogoEnabled $foodcourtLogoEnabled;
  1956.     }
  1957.     public function isOnlineOrderGiftEnabled(): bool
  1958.     {
  1959.         return $this->onlineOrderGiftEnabled;
  1960.     }
  1961.     public function setOnlineOrderGiftEnabled(bool $onlineOrderGiftEnabled): void
  1962.     {
  1963.         $this->onlineOrderGiftEnabled $onlineOrderGiftEnabled;
  1964.     }
  1965.     public function isBuyCodeInAppOnly(): bool
  1966.     {
  1967.         return $this->buyCodeInAppOnly;
  1968.     }
  1969.     public function setBuyCodeInAppOnly(bool $buyCodeInAppOnly): void
  1970.     {
  1971.         $this->buyCodeInAppOnly $buyCodeInAppOnly;
  1972.     }
  1973.     public function isShowProductsInOfferDescription(): bool
  1974.     {
  1975.         return $this->showProductsInOfferDescription;
  1976.     }
  1977.     public function setShowProductsInOfferDescription(bool $showProductsInOfferDescription): void
  1978.     {
  1979.         $this->showProductsInOfferDescription $showProductsInOfferDescription;
  1980.     }
  1981.     public function isCheckAddressInOfferMenu(): bool
  1982.     {
  1983.         return $this->checkAddressInOfferMenu;
  1984.     }
  1985.     public function setCheckAddressInOfferMenu(bool $checkAddressInOfferMenu): void
  1986.     {
  1987.         $this->checkAddressInOfferMenu $checkAddressInOfferMenu;
  1988.     }
  1989.     public function isShowMapIconInApp(): bool
  1990.     {
  1991.         return $this->showMapIconInApp;
  1992.     }
  1993.     public function setShowMapIconInApp(bool $showMapIconInApp): void
  1994.     {
  1995.         $this->showMapIconInApp $showMapIconInApp;
  1996.     }
  1997.     public function isDuplicateCodesEnable(): bool
  1998.     {
  1999.         return in_array($this->ID, [
  2000.                 self::CAR_SHARING_OFFER_ID,
  2001.                 280939,
  2002.                 289045,
  2003.                 289751,
  2004.                 self::TL24_OFFER_ID,
  2005.                 294815,
  2006.                 296038,
  2007.                 296656,
  2008.             ],
  2009.             true,
  2010.         );
  2011.     }
  2012.     public function getCityByFirstCategory(): ?City
  2013.     {
  2014.         return $this->categories->count() > $this->categories->first()->getCity() : null;
  2015.     }
  2016.     public function isSeparateTabForCertificatesInApp(): bool
  2017.     {
  2018.         return $this->separateTabForCertificatesInApp;
  2019.     }
  2020.     public function setSeparateTabForCertificatesInApp(bool $separateTabForCertificatesInApp): void
  2021.     {
  2022.         $this->separateTabForCertificatesInApp $separateTabForCertificatesInApp;
  2023.     }
  2024.     public function getMapPrice(): ?float
  2025.     {
  2026.         return $this->mapPrice;
  2027.     }
  2028.     public function updateMapPrice(?float $mapPrice): void
  2029.     {
  2030.         $this->mapPrice $mapPrice;
  2031.     }
  2032.     public function getMapRating(): ?int
  2033.     {
  2034.         return $this->mapRating;
  2035.     }
  2036.     public function updateMapRating(?int $mapRating): void
  2037.     {
  2038.         $this->mapRating $mapRating;
  2039.     }
  2040.     public function getSumInCurrency(float $sum): ?float
  2041.     {
  2042.         return $this->isActiveCurrencyCalculator() && null !== $this->getBankCurrency()
  2043.             ? $sum $this->getBankCurrency()->getRate()
  2044.             : null;
  2045.     }
  2046.     public function getDirectorName(): ?string
  2047.     {
  2048.         if (null !== $this->directorName) {
  2049.             return $this->directorName;
  2050.         }
  2051.         if ($this->directors->count() > 0) {
  2052.             $directorName $this->directors->first()->getName();
  2053.             $this->directorName $directorName;
  2054.             return $directorName;
  2055.         }
  2056.         return null;
  2057.     }
  2058.     public function getOfferFoodDeliveryZoneNames(): array
  2059.     {
  2060.         if (null === $this->offerFoodDeliveryZone) {
  2061.             return [];
  2062.         }
  2063.         $sortedZoneNames = [];
  2064.         foreach ($this->offerFoodDeliveryZone->toArray() as $zone) {
  2065.             $sortedZoneNames[$zone->getPosition()] = $zone->getName();
  2066.         }
  2067.         return $sortedZoneNames;
  2068.     }
  2069.     public function getTelegram(): ?string
  2070.     {
  2071.         return $this->telegram;
  2072.     }
  2073.     public function getViber(): ?string
  2074.     {
  2075.         return $this->viber;
  2076.     }
  2077.     public function setTelegram(?string $telegram): void
  2078.     {
  2079.         $this->telegram $telegram;
  2080.     }
  2081.     public function setViber(?string $viber): void
  2082.     {
  2083.         $this->viber $viber;
  2084.     }
  2085.     public function getMessengerCallBack(): ?string
  2086.     {
  2087.         return $this->messengerCallBack;
  2088.     }
  2089.     public function setMessengerCallBack(?string $messengerCallBack): void
  2090.     {
  2091.         $this->messengerCallBack $messengerCallBack;
  2092.     }
  2093.     public function isBundleOffer(): bool
  2094.     {
  2095.         return in_array(
  2096.             $this->getID(),
  2097.             [
  2098.                 self::MARSEL_MASSAGE_OFFER_ID,
  2099.                 self::FREESTYLE_CERTIFICATE_OFFER_ID,
  2100.                 self::FREESTYLE_FLOATING_CERTIFICATE_OFFER_ID,
  2101.             ],
  2102.             true
  2103.         );
  2104.     }
  2105.     public function getTelegramLink(): ?string
  2106.     {
  2107.         if (empty($this->telegram) && $this->defaultCityId !== City::TASHKENT_CITY_ID) {
  2108.             return self::DEFAULT_TELEGRAM;
  2109.         }
  2110.         return $this->telegram;
  2111.     }
  2112.     public function getViberLink(): ?string
  2113.     {
  2114.         if (empty($this->viber) && $this->defaultCityId !== City::TASHKENT_CITY_ID) {
  2115.             return self::DEFAULT_VIBER;
  2116.         }
  2117.         return $this->viber;
  2118.     }
  2119.     public function getYclientAppKey(): ?string
  2120.     {
  2121.         return $this->yclientAppKey;
  2122.     }
  2123.     public function setYclientAppKey(?string $yclientAppKey): void
  2124.     {
  2125.         $this->yclientAppKey $yclientAppKey;
  2126.     }
  2127.     public function getYclientCompanyId(): ?string
  2128.     {
  2129.         return $this->yclientCompanyId;
  2130.     }
  2131.     public function yclientCompanyIds(): array
  2132.     {
  2133.         return array_map(
  2134.             static fn (string $companyId) => (int) $companyId,
  2135.             explode(','$this->yclientCompanyId)
  2136.         );
  2137.     }
  2138.     public function setYclientCompanyId(?string $yclientCompanyId): void
  2139.     {
  2140.         $this->yclientCompanyId $yclientCompanyId;
  2141.     }
  2142.     public function isAvailableYclient(): bool
  2143.     {
  2144.         return $this->yclientCompanyId !== null && $this->yclientAppKey !== null;
  2145.     }
  2146.     public function getAllowedPaymentMethodsForCertificate(): ?array
  2147.     {
  2148.         return $this->allowedPaymentMethodsForCertificate;
  2149.     }
  2150.     public function setAllowedPaymentMethodsForCertificate(?array $allowedPaymentMethodsForCertificate): void
  2151.     {
  2152.         $this->allowedPaymentMethodsForCertificate $allowedPaymentMethodsForCertificate;
  2153.     }
  2154.     public function isOnlinePaymentForCertificate(): bool
  2155.     {
  2156.         return array_key_exists((string)  PaymentType::ONLINE$this->allowedPaymentMethodsForCertificate)
  2157.             && (bool) $this->allowedPaymentMethodsForCertificate[(string) PaymentType::ONLINE];
  2158.     }
  2159.     public function isCashPaymentForCertificate(): bool
  2160.     {
  2161.         return array_key_exists((string) PaymentType::CASH$this->allowedPaymentMethodsForCertificate)
  2162.             && (bool) $this->allowedPaymentMethodsForCertificate[(string) PaymentType::CASH];
  2163.     }
  2164.     public function isTerminalPaymentForCertificate(): bool
  2165.     {
  2166.         return array_key_exists((string) PaymentType::TERMINAL$this->allowedPaymentMethodsForCertificate)
  2167.             && (bool) $this->allowedPaymentMethodsForCertificate[(string) PaymentType::TERMINAL];
  2168.     }
  2169.     public function isSlivkiPayPaymentForCertificate(): bool
  2170.     {
  2171.         return array_key_exists((string)PaymentType::SLIVKI_PAY$this->allowedPaymentMethodsForCertificate)
  2172.             && (bool) $this->allowedPaymentMethodsForCertificate[(string) PaymentType::SLIVKI_PAY];
  2173.     }
  2174.     public function isFestOffer(): bool
  2175.     {
  2176.         return $this->festOffer;
  2177.     }
  2178.     public function setFestOffer(bool $festOffer): void
  2179.     {
  2180.         $this->festOffer $festOffer;
  2181.     }
  2182. }