RateLimit::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
nc 1
nop 2
dl 0
loc 2
rs 10
c 1
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Utilities\Router\Attributes;
5
6
/**
7
 * RateLimit class
8
 *
9
 * @link    https://github.com/utilities-php/router
10
 * @author  Shahrad Elahi (https://github.com/shahradelahi)
11
 * @license https://github.com/utilities-php/router/blob/master/LICENSE (MIT License)
12
 */
13
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD)]
14
class RateLimit
15
{
16
17
    /**
18
     * @param int $period The number of seconds in which the limit is applied. (in milliseconds)
19
     * @param int $rate The number of requests allowed in the period.
20
     */
21
    public function __construct(protected int $period, protected int $rate)
22
    {
23
24
    }
25
26
    /**
27
     * @return int
28
     */
29
    public function getPeriod(): int
30
    {
31
        return $this->period;
32
    }
33
34
    /**
35
     * @return int
36
     */
37
    public function getRate(): int
38
    {
39
        return $this->rate;
40
    }
41
42
}