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

FindSiteResponse::getError()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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