These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace Chubbyphp\ApiHttp\ApiProblem\ClientError; |
||
6 | |||
7 | use Chubbyphp\ApiHttp\ApiProblem\AbstractApiProblem; |
||
8 | |||
9 | View Code Duplication | final class RequestEntityTooLarge extends AbstractApiProblem |
|
0 ignored issues
–
show
|
|||
10 | { |
||
11 | /** |
||
12 | * @var int |
||
13 | */ |
||
14 | private $maxContentLength; |
||
15 | |||
16 | /** |
||
17 | * @param int $maxContentLength |
||
18 | * @param string $title |
||
19 | * @param string|null $detail |
||
20 | * @param string|null $instance |
||
21 | */ |
||
22 | 2 | public function __construct(int $maxContentLength, string $title, string $detail = null, string $instance = null) |
|
23 | { |
||
24 | 2 | parent::__construct($title, $detail, $instance); |
|
25 | |||
26 | 2 | $this->maxContentLength = $maxContentLength; |
|
27 | 2 | } |
|
28 | |||
29 | /** |
||
30 | * @return int |
||
31 | */ |
||
32 | 2 | public function getStatus(): int |
|
33 | { |
||
34 | 2 | return 413; |
|
35 | } |
||
36 | |||
37 | /** |
||
38 | * @return int |
||
39 | */ |
||
40 | 2 | public function getType(): string |
|
41 | { |
||
42 | 2 | return 'https://tools.ietf.org/html/rfc2616#section-10.4.14'; |
|
43 | } |
||
44 | |||
45 | /** |
||
46 | * @return int |
||
47 | */ |
||
48 | 2 | public function getMaxContentLength(): int |
|
49 | { |
||
50 | 2 | return $this->maxContentLength; |
|
51 | } |
||
52 | } |
||
53 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.