Your IP : 18.226.150.171


Current Path : /var/www/www-root/data/www/monolith-realty.ru/bitrix/modules/main/lib/UpdateSystem/
Upload File :
Current File : /var/www/www-root/data/www/monolith-realty.ru/bitrix/modules/main/lib/UpdateSystem/Coupon.php

<?php
namespace Bitrix\Main\UpdateSystem;

class Coupon
{
	private string $coupon;

	public function __construct(string $coupon)
	{
		$this->coupon = $coupon;
	}

	public function isCoupone(): bool
	{
		if (!preg_match("#^[A-Z0-9]{3}-[A-Z]{2}-?[A-Z0-9]{12,30}$#i", $this->coupon)
			&& !preg_match("#^[A-Z0-9]{3}-[A-Z0-9]{10}-[A-Z0-9]{10}$#i", $this->coupon))
		{
			return false;
		}

		return true;
	}

	public function getKey(): string
	{
		return $this->coupon;
	}
}