RateLimitException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 4
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of SteamScore.
7
 *
8
 * (c) SteamScore <[email protected]>
9
 *
10
 * This Source Code Form is subject to the terms of the Mozilla Public
11
 * License, v. 2.0. If a copy of the MPL was not distributed with this
12
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
13
 */
14
15
namespace SteamScore\Api\Domain\Exceptions;
16
17
use Exception;
18
use Throwable;
19
20
final class RateLimitException extends Exception
21
{
22
    /**
23
     * @var float
24
     */
25
    private $secondsToWait;
26
27
    /**
28
     * Constructor.
29
     *
30
     * @param float     $secondsToWait
31
     * @param string    $message
32
     * @param int       $code
33
     * @param Throwable $previous
34
     */
35 1
    public function __construct(float $secondsToWait, string $message = '', int $code = 0, Throwable $previous = null)
36
    {
37 1
        parent::__construct($message, $code, $previous);
38
39 1
        $this->secondsToWait = $secondsToWait;
40
    }
41
42
    /**
43
     * Gets seconds to wait.
44
     *
45
     * @return float
46
     */
47 1
    public function getSecondsToWait(): float
48
    {
49 1
        return $this->secondsToWait;
50
    }
51
}
52