GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 2e10ac...ed1d01 )
by Henrik
9s
created

PlainMessageNormalizer   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 39
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A normalize() 0 7 1
A denormalize() 0 6 1
A supportsDenormalization() 0 4 1
A supportsNormalization() 0 4 1
1
<?php
2
3
namespace Bernard\Normalizer;
4
5
use Assert\Assertion;
6
use Bernard\Message\PlainMessage;
7
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
8
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
9
10
/**
11
 * @package Bernard
12
 */
13
class PlainMessageNormalizer implements NormalizerInterface, DenormalizerInterface
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function normalize($object, $format = null, array $context = [])
19
    {
20
        return [
21
            'name' => $object->getName(),
22
            'arguments' => $object->all(),
23
        ];
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function denormalize($data, $class, $format = null, array $context = [])
30
    {
31
        Assertion::choicesNotEmpty($data, ['name', 'arguments']);
32
33
        return new PlainMessage($data['name'], $data['arguments']);
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function supportsDenormalization($data, $type, $format = null)
40
    {
41
        return $type === 'Bernard\Message\PlainMessage';
42
    }
43
44
    /**
45
     * {@inheritdoc}
46
     */
47
    public function supportsNormalization($data, $format = null)
48
    {
49
        return $data instanceof PlainMessage;
50
    }
51
}
52