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

ApiProblem/ClientError/MethodNotAllowedMapping.php (1 issue)

Upgrade to new PHP Analysis Engine

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\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
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