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::normalize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 3
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