Test Failed
Pull Request — main (#25)
by Vasil
03:46
created

FindOfficeRequest::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 4
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 6
ccs 0
cts 0
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace VasilDakov\Speedy\Service\Location\Office;
6
7
use VasilDakov\Speedy\Property;
8
use VasilDakov\Speedy\Traits\ToArray;
9
10
/**
11
 * Class FindOfficeRequest.
12
 *
13
 * @author Vasil Dakov <[email protected]>
14
 * @copyright 2009-2022 Neutrino.bg
15
 *
16
 * @version 1.0
17
 */
18
class FindOfficeRequest
19
{
20
    use ToArray;
0 ignored issues
show
Bug introduced by
The trait VasilDakov\Speedy\Traits\ToArray requires the property $value which is not provided by VasilDakov\Speedy\Servic...ffice\FindOfficeRequest.
Loading history...
21
22
    private ?int $countryId;
23 2
24
    private ?int $siteId;
25 2
26
    private ?string $name;
27
28 1
    public function __construct(?int $countryId = null, ?int $siteId = null, ?string $name = null)
29
    {
30 1
        $this->countryId = $countryId;
31
        $this->siteId    = $siteId;
32
        $this->name = $name;
33
    }
34
35
    /**
36
     * @return int
37
     */
38
    public function getCountryId(): int
39
    {
40
        return $this->countryId;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->countryId could return the type null which is incompatible with the type-hinted return integer. Consider adding an additional type-check to rule them out.
Loading history...
41
    }
42
43
44
    public function toArray(): array
45
    {
46
        return [
47
            Property::COUNTRY_ID->value => $this->countryId,
48
            Property::SITE_ID->value => $this->siteId,
49
            Property::NAME->value => $this->name,
50
        ];
51
    }
52
}
53