ViolationNormalizer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 21
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A normalize() 0 8 1
A getType() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Paysera\Bundle\ApiBundle\Normalizer;
5
6
use Paysera\Bundle\ApiBundle\Entity\Violation;
7
use Paysera\Component\Normalization\NormalizationContext;
8
use Paysera\Component\Normalization\NormalizerInterface;
9
use Paysera\Component\Normalization\TypeAwareInterface;
10
11
class ViolationNormalizer implements NormalizerInterface, TypeAwareInterface
12
{
13
    /**
14
     * @param Violation $result
15
     * @param NormalizationContext $normalizationContext
16
     * @return array
17
     */
18 12
    public function normalize($result, NormalizationContext $normalizationContext)
19
    {
20
        return [
21 12
            'code' => $result->getCode(),
22 12
            'message' => $result->getMessage(),
23 12
            'field' => $result->getField(),
24
        ];
25
    }
26
27 96
    public function getType(): string
28
    {
29 96
        return Violation::class;
30
    }
31
}
32