FindSiteResponse   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 86.67%

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 40
ccs 13
cts 15
cp 0.8667
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setSites() 0 3 1
A getError() 0 3 1
A getSites() 0 3 1
A toArray() 0 5 1
A setError() 0 3 1
A __construct() 0 4 1
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