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 ( 8adfc3...aede48 )
by Pascal
9s
created

Service::setVersion()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Saikootau\ApiBundle\Resource;
6
7
use DateTimeImmutable;
8
use DateTimeInterface;
9
use JMS\Serializer\Annotation as Serializer;
10
11
/**
12
 * @Serializer\XmlRoot(name="service")
13
 */
14
class Service
15
{
16
    public const DEFAULT_VERSION = '1.0';
17
18
    /**
19
     * @Serializer\XmlAttribute
20
     * @Serializer\Type("string")
21
     *
22
     * @var string
23
     */
24
    private $version = self::DEFAULT_VERSION;
25
26
    /**
27
     * @Serializer\XmlAttribute
28
     * @Serializer\Type("DateTimeImmutable<'Y-m-d\TH:i:sP'>")
29
     *
30
     * @var DateTimeInterface
31
     */
32
    private $timestamp;
33
34
    /**
35
     * @Serializer\Type("Saikootau\ApiBundle\Resource\Request")
36
     *
37
     * @var Request
38
     */
39
    private $request;
40
41
    /**
42
     * @Serializer\XmlList(
43
     *     inline=true,
44
     *     entry="error"
45
     * )
46
     * @Serializer\SerializedName("errors")
47
     * @Serializer\Type("array<Saikootau\ApiBundle\Resource\Error>")
48
     *
49
     * @var Error[]
50
     */
51
    private $errors;
52
53 13
    public function __construct(Request $request, Error ...$errors)
54
    {
55 13
        $this->errors = $errors;
56 13
        $this->request = $request;
57 13
        $this->timestamp = new DateTimeImmutable();
58 13
    }
59
60
    /**
61
     * Returns the api version of this response.
62
     *
63
     * @return string
64
     */
65 3
    public function getVersion(): string
66
    {
67 3
        return $this->version;
68
    }
69
70
    /**
71
     * Set the api version for this response.
72
     *
73
     * @param string $version
74
     *
75
     * @return Service
76
     */
77 1
    public function setVersion(string $version): self
78
    {
79 1
        $this->version = $version;
80
81 1
        return $this;
82
    }
83
84
    /**
85
     * Returns the timestamp this response was created at.
86
     *
87
     * @return DateTimeInterface
88
     */
89 2
    public function getTimestamp(): DateTimeInterface
90
    {
91 2
        return $this->timestamp;
92
    }
93
94
    /**
95
     * Returns the request associated with this response.
96
     *
97
     * @return Request
98
     */
99 3
    public function getRequest(): Request
100
    {
101 3
        return $this->request;
102
    }
103
104
    /**
105
     * Returns a list of errors associated with this response.
106
     *
107
     * @return Error[]
108
     */
109 4
    public function getErrors(): array
110
    {
111 4
        return $this->errors;
112
    }
113
}
114