Passed
Push — main ( 98c11d...80b66f )
by Vasil
03:34
created

FindSiteResponse   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 41
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getSites() 0 3 1
A __construct() 0 4 1
A getError() 0 3 1
A toArray() 0 5 1
A setError() 0 3 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 VasilDakov\Speedy\Error;
9
use VasilDakov\Speedy\Model\Site;
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
 * @version   1.0
18
 * @see       https://api.speedy.bg/web-api.html#href-find-site-resp
19
 */
20
class FindSiteResponse
21
{
22
    private ArrayCollection $sites;
23
24
    private ?Error $error = null;
25
26 1
    public function __construct(Error $error = null)
27
    {
28 1
        $this->sites = new ArrayCollection();
29 1
        $this->error = $error;
30
    }
31
32
    /**
33
     * @return ArrayCollection
34
     */
35 1
    public function getSites(): ArrayCollection
36
    {
37 1
        return $this->sites;
38
    }
39
40
    /**
41
     * @return Error|null
42
     */
43 1
    public function getError(): ?Error
44
    {
45 1
        return $this->error;
46
    }
47
48
    /**
49
     * @param Error|null $error
50
     */
51 1
    public function setError(?Error $error): void
52
    {
53 1
        $this->error = $error;
54
    }
55
56 1
    public function toArray(): array
57
    {
58 1
        return [
59 1
            'sites' => $this->getSites(),
60 1
            'error' => $this->getError()
61 1
        ];
62
    }
63
}
64