FindSiteResponse::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace VasilDakov\Speedy\Service\Location\Site;
6
7
use Doctrine\Common\Collections\ArrayCollection;
8
use JMS\Serializer\Annotation as Serializer;
9
use VasilDakov\Speedy\Error;
10
11
/**
12
 * Class FindSiteResponse.
13
 *
14
 * @author    Vasil Dakov <[email protected]>
15
 * @author    Valentin Valkanov <[email protected]>
16
 * @copyright 2009-2022 Neutrino.bg
17
 *
18
 * @version   1.0
19
 *
20
 * @see       https://api.speedy.bg/web-api.html#href-find-site-resp
21
 *
22
 * @Serializer\AccessType("public_method")
23
 */
24
class FindSiteResponse
25
{
26
    /**
27
     * @Serializer\Type("ArrayCollection<VasilDakov\Speedy\Model\Site>")
28
     */
29
    private ArrayCollection $sites;
30
31
    private ?Error $error = null;
32
33 1
    public function __construct(Error $error = null)
34
    {
35 1
        $this->sites = new ArrayCollection();
36 1
        $this->error = $error;
37
    }
38
39
    public function setSites(ArrayCollection $sites): void
40
    {
41
        $this->sites = $sites;
42
    }
43
44 1
    public function getSites(): ArrayCollection
45
    {
46 1
        return $this->sites;
47
    }
48
49 1
    public function getError(): ?Error
50
    {
51 1
        return $this->error;
52
    }
53
54 1
    public function setError(?Error $error): void
55
    {
56 1
        $this->error = $error;
57
    }
58
59 1
    public function toArray(): array
60
    {
61 1
        return [
62 1
            'sites' => $this->getSites(),
63 1
            'error' => $this->getError(),
64 1
        ];
65
    }
66
}
67