Completed
Push — master ( 9dea23...268780 )
by WEBEWEB
01:42
created

RateLimitTrait::getLimit()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the core-library package.
5
 *
6
 * (c) 2021 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Library\Core\Model;
13
14
use DateTime;
15
16
/**
17
 * Rate limit trait.
18
 *
19
 * @author webeweb <https://github.com/webeweb/>
20
 * @package WBW\Library\Core\Model
21
 */
22
trait RateLimitTrait {
23
24
    /**
25
     * Limit.
26
     *
27
     * @var int|null
28
     */
29
    private $limit;
30
31
    /**
32
     * Remaining.
33
     *
34
     * @var int|null
35
     */
36
    private $remaining;
37
38
    /**
39
     * Reset.
40
     *
41
     * @var DateTime|null
42
     */
43
    private $reset;
44
45
    /**
46
     * Get the limit.
47
     *
48
     * @return int|null Returns the limit.
49
     */
50
    public function getLimit(): ?int {
51
        return $this->limit;
52
    }
53
54
    /**
55
     * Get the remaining.
56
     *
57
     * @return int|null Returns the remaining.
58
     */
59
    public function getRemaining(): ?int {
60
        return $this->remaining;
61
    }
62
63
    /**
64
     * Get the reset.
65
     *
66
     * @return DateTime|null Returns reset.
67
     */
68
    public function getReset(): ?DateTime {
69
        return $this->reset;
70
    }
71
72
    /**
73
     * Set the limit.
74
     *
75
     * @param int|null $limit The limit.
76
     * @return self Returns this instance.
77
     */
78
    public function setLimit(?int $limit): self {
79
        $this->limit = $limit;
80
        return $this;
81
    }
82
83
    /**
84
     * Set the remaining.
85
     *
86
     * @param int|null $remaining The remaining.
87
     * @return self Returns this instance.
88
     */
89
    public function setRemaining(?int $remaining): self {
90
        $this->remaining = $remaining;
91
        return $this;
92
    }
93
94
    /**
95
     * Set the reset.
96
     *
97
     * @param DateTime|null $reset The reset.
98
     * @return self Returns this instance.
99
     */
100
    public function setReset(?DateTime $reset): self {
101
        $this->reset = $reset;
102
        return $this;
103
    }
104
}
105