Passed
Push — master ( 6ff058...ae4c71 )
by Dominik
01:51
created

MethodNotAllowedMapping::getClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 4
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chubbyphp\ApiHttp\Serialization\ApiProblem\ClientError;
6
7
use Chubbyphp\ApiHttp\ApiProblem\ClientError\MethodNotAllowed;
8
use Chubbyphp\ApiHttp\Serialization\ApiProblem\AbstractApiProblemMapping;
9
use Chubbyphp\Serialization\Mapping\NormalizationFieldMappingBuilder;
10
use Chubbyphp\Serialization\Mapping\NormalizationFieldMappingInterface;
11
12 View Code Duplication
final class MethodNotAllowedMapping extends AbstractApiProblemMapping
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

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.

Loading history...
13
{
14
    /**
15
     * @return string
16
     */
17 1
    public function getClass(): string
18
    {
19 1
        return MethodNotAllowed::class;
20
    }
21
22
    /**
23
     * @param string $path
24
     *
25
     * @return NormalizationFieldMappingInterface[]
26
     */
27 1
    public function getNormalizationFieldMappings(string $path): array
28
    {
29 1
        $fieldMappings = parent::getNormalizationFieldMappings($path);
30
31 1
        $fieldMappings[] = NormalizationFieldMappingBuilder::create('method')->getMapping();
32 1
        $fieldMappings[] = NormalizationFieldMappingBuilder::create('allowedMethods')->getMapping();
33
34 1
        return $fieldMappings;
35
    }
36
}
37