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
Pull Request — master (#1)
by Pascal
03:02 queued 27s
created

AbstractSerializer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 47
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A serialize() 0 5 1
A __construct() 0 3 1
A deserialize() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Saikootau\ApiBundle\Serializer;
6
7
use JMS\Serializer\Serializer as JMSSerializer;
8
9
abstract class AbstractSerializer implements Serializer
10
{
11
    private $serializer;
12
13 7
    public function __construct(JMSSerializer $serializer)
14
    {
15 7
        $this->serializer = $serializer;
16 7
    }
17
18
    /**
19
     * Serialize the document to a format.
20
     *
21
     * @param object $document
22
     *
23
     * @return string
24
     */
25 2
    public function serialize(object $document): string
26
    {
27 2
        return $this->serializer->serialize(
28 2
            $document,
29 2
            $this->getSupportedFormat()
30
        );
31
    }
32
33
    /**
34
     * Deserialize the document to a PHP object of the given class.
35
     *
36
     * @param string $document
37
     * @param string $className
38
     *
39
     * @return object
40
     */
41 3
    public function deserialize(string $document, string $className): object
42
    {
43 3
        return $this->serializer->deserialize(
44 3
            $document,
45 3
            $className,
46 3
            $this->getSupportedFormat()
47
        );
48
    }
49
50
    /**
51
     * Return the supported format by the serializer.
52
     *
53
     * @return string
54
     */
55
    abstract public function getSupportedFormat(): string;
56
}
57