HeaderLimits.php
730 Bytes
<?php
namespace App\Service;
class HeaderLimits implements \App\Service\Contract\HeaderLimits{
private $dayLimit = 0;
private $currentLimit = 0;
private $spentLimit = 0;
function __construct(Array $headers)
{
if (!isset($headers['Units'])){
throw new \Exception('Не найден заголовок с баллами');
}
list($this->spentLimit, $this->currentLimit, $this->dayLimit) = explode("/", $headers['Units']);
}
function getDayLimit(): int
{
return $this->dayLimit;
}
function getCurrentLimit(): int
{
return $this->currentLimit;
}
function getSpentLimit(): int
{
return $this->spentLimit;
}
}