Test Failed
Push — master ( c65274...a98fd4 )
by Alexander
18:33
created

DeliveryLimitReachedException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 24
ccs 4
cts 4
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getTimeout() 0 3 1
A getAttempts() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Wearesho\Yii\Exceptions;
6
7
use Carbon\Carbon;
8
use Carbon\CarbonInterval;
9
10
class DeliveryLimitReachedException extends TokenException
11
{
12
    protected CarbonInterval $timeout;
13
14
    protected int $attempts;
15
16
    public function __construct(int $attempts, CarbonInterval $timeout, $code = 0, \Throwable $previous = null)
17
    {
18
        $message = "Delivery limit of {$attempts} reached. Try after "
19
            . Carbon::now()->add($timeout)->toDateTimeString();
20
        parent::__construct($message, $code, $previous);
21
22
        $this->attempts = $attempts;
23
        $this->timeout = $timeout;
24
    }
25
26
    public function getAttempts(): int
27
    {
28 1
        return $this->attempts;
29
    }
30 1
31 1
    public function getTimeout(): CarbonInterval
32 1
    {
33
        return $this->timeout;
34 1
    }
35
}
36