Your IP : 3.142.166.46


Current Path : /var/www/admin_ftp_12/data/www/httpdocs/bitrix/modules/main/lib/UpdateSystem/
Upload File :
Current File : /var/www/admin_ftp_12/data/www/httpdocs/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;
	}
}