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