Passed
Push — master ( 65d8ad...c74ce3 )
by Pieter
04:45 queued 14s
created

MethodNotAllowedException::getI18n()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
4
namespace W2w\Lib\Apie\Exceptions;
5
6
use W2w\Lib\ApieObjectAccessNormalizer\Exceptions\LocalizationableException;
7
use W2w\Lib\ApieObjectAccessNormalizer\Exceptions\LocalizationInfo;
8
9
/**
10
 * Exception thrown when a wrong HTTP method is chosen.
11
 */
12
class MethodNotAllowedException extends ApieException implements LocalizationableException
0 ignored issues
show
Deprecated Code introduced by
The class W2w\Lib\Apie\Exceptions\ApieException has been deprecated: use \W2w\Lib\ApieObjectAccessNormalizer\Exceptions\ApieException ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

12
class MethodNotAllowedException extends /** @scrutinizer ignore-deprecated */ ApieException implements LocalizationableException
Loading history...
13
{
14
    /**
15
     * @var string
16
     */
17
    private $method;
18
19
    public function __construct(string $method)
20
    {
21
        $this->method = $method;
22
        parent::__construct(405, "Resource has no " . $method . " support");
23
    }
24
25
    public function getI18n(): LocalizationInfo
26
    {
27
        return new LocalizationInfo(
28
            'general.method_not_allowed',
29
            [
30
                'method' => $this->method,
31
            ]
32
        );
33
    }
34
}
35