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

XtoolsTooManyRequestsHttpException::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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