1 | <?php |
||
24 | class Handler |
||
25 | { |
||
26 | const MINIMUM_VALUE = 0; |
||
27 | |||
28 | /** |
||
29 | * @var ProviderInterface |
||
30 | */ |
||
31 | protected $provider; |
||
32 | |||
33 | /** |
||
34 | * Handler constructor. |
||
35 | * |
||
36 | * @param ProviderInterface $provider provider |
||
37 | */ |
||
38 | public function __construct(ProviderInterface $provider) |
||
42 | |||
43 | /** |
||
44 | * @param string $key key |
||
45 | * @param int $limit limit |
||
46 | * |
||
47 | * @return bool |
||
48 | */ |
||
49 | public function start(string $key, int $limit): bool |
||
61 | |||
62 | /** |
||
63 | * @param string $key key |
||
64 | * |
||
65 | * @return void |
||
66 | */ |
||
67 | public function end(string $key)/*: void*/ |
||
77 | |||
78 | /** |
||
79 | * @param string $key key |
||
80 | * @param int $value value |
||
81 | * |
||
82 | * @throws LessThanMinimumException |
||
83 | * @throws SaveException |
||
84 | * |
||
85 | * @return void |
||
86 | */ |
||
87 | protected function save(string $key, int $value)/*: void*/ |
||
99 | } |