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

DeliveryLimitReachedException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 4
dl 0
loc 8
ccs 0
cts 0
cp 0
crap 2
rs 10
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