Passed
Push — rate-limit-improvements ( be34fb...f1c343 )
by MusikAnimal
03:25
created

XtoolsTooManyRequestsHttpException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 28
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A __toString() 0 3 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace App\Exception;
6
7
use Symfony\Component\HttpKernel\Exception\TooManyRequestsHttpException;
8
use Throwable;
9
use Twig\Markup;
10
11
class XtoolsTooManyRequestsHttpException extends TooManyRequestsHttpException
12
{
13
    protected Markup $markup;
14
15
    /**
16
     * @param Markup $markup
17
     * @param int $retryAfter
18
     * @param Throwable|null $previous
19
     * @param int|null $code
20
     * @param array $headers
21
     */
22
    public function __construct(
23
        Markup $markup,
24
        int $retryAfter,
25
        ?Throwable $previous = null,
26
        ?int $code = 0,
27
        array $headers = []
28
    ) {
29
        $this->markup = $markup;
30
        parent::__construct($retryAfter, $this->getMessage(), $previous, $code, $headers);
31
    }
32
33
    /**
34
     * @return Markup
35
     */
36
    public function __toString(): string
37
    {
38
        return (string)$this->markup;
39
    }
40
}
41