Completed
Push — master ( f80d0f...3008ec )
by Nikola
08:08
created

LimitExceeded::getIdentifier()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace RateLimit\Exception;
6
7
use RateLimit\Rate;
8
use RuntimeException;
9
10
final class LimitExceeded extends RuntimeException
11
{
12
    /** @var string */
13
    protected $identifier;
14
15
    /** @var Rate */
16
    protected $rate;
17
18
    public static function for(string $identifier, Rate $rate): self
19
    {
20
        $exception = new self("Limit of has been exceeded by identifier: $identifier");
21
        $exception->identifier = $identifier;
22
        $exception->rate = $rate;
23
24
        return $exception;
25
    }
26
27
    public function getIdentifier(): string
28
    {
29
        return $this->identifier;
30
    }
31
32
    public function getRate(): Rate
33
    {
34
        return $this->rate;
35
    }
36
}
37