GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#75)
by joseph
14:44
created

AddressEmbeddable::setCountryCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 10
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Objects\Geo;
4
5
use Doctrine\ORM\Mapping\ClassMetadata;
6
use EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Interfaces\Geo\HasAddressEmbeddableInterface;
7
use EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Interfaces\Objects\Geo\AddressEmbeddableInterface;
8
use EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Objects\AbstractEmbeddableObject;
9
use EdmondsCommerce\DoctrineStaticMeta\MappingHelper;
10
11
class AddressEmbeddable extends AbstractEmbeddableObject implements AddressEmbeddableInterface
12
{
13
    /**
14
     * @var string
15
     */
16
    private $houseNumber;
17
    /**
18
     * @var string
19
     */
20
    private $houseName;
21
    /**
22
     * @var string
23
     */
24
    private $street;
25
    /**
26
     * @var string
27
     */
28
    private $city;
29
    /**
30
     * @var string
31
     */
32
    private $countryCode;
33
    /**
34
     * @var string
35
     */
36
    private $postalCode;
37
    /**
38
     * @var string
39
     */
40
    private $postalArea;
41
42
    /**
43
     * @return string
44
     */
45 1
    public function getHouseNumber(): string
46
    {
47 1
        return $this->houseNumber ?? '';
48
    }
49
50
    /**
51
     * @param string $houseNumber
52
     *
53
     * @return AddressEmbeddable
54
     */
55 2
    public function setHouseNumber(string $houseNumber): AddressEmbeddableInterface
56
    {
57 2
        $this->notifyEmbeddablePrefixedProperties(
58 2
            'houseNumber',
59 2
            $this->houseNumber,
60 2
            $houseNumber
61
        );
62 2
        $this->houseNumber = $houseNumber;
63
64 2
        return $this;
65
    }
66
67
    /**
68
     * @return string
69
     */
70 1
    public function getHouseName(): string
71
    {
72 1
        return $this->houseName ?? '';
73
    }
74
75
    /**
76
     * @param string $houseName
77
     *
78
     * @return AddressEmbeddable
79
     */
80 2
    public function setHouseName(string $houseName): AddressEmbeddableInterface
81
    {
82 2
        $this->notifyEmbeddablePrefixedProperties(
83 2
            'houseName',
84 2
            $this->houseName,
85 2
            $houseName
86
        );
87 2
        $this->houseName = $houseName;
88
89 2
        return $this;
90
    }
91
92
    /**
93
     * @return string
94
     */
95 1
    public function getStreet(): string
96
    {
97 1
        return $this->street ?? '';
98
    }
99
100
    /**
101
     * @param string $street
102
     *
103
     * @return AddressEmbeddable
104
     */
105 2
    public function setStreet(string $street): AddressEmbeddableInterface
106
    {
107 2
        $this->notifyEmbeddablePrefixedProperties(
108 2
            'street',
109 2
            $this->street,
110 2
            $street
111
        );
112 2
        $this->street = $street;
113
114 2
        return $this;
115
    }
116
117
    /**
118
     * @return string
119
     */
120 1
    public function getCity(): string
121
    {
122 1
        return $this->city ?? '';
123
    }
124
125
    /**
126
     * @param string $city
127
     *
128
     * @return AddressEmbeddable
129
     */
130 2
    public function setCity(string $city): AddressEmbeddableInterface
131
    {
132 2
        $this->notifyEmbeddablePrefixedProperties(
133 2
            'city',
134 2
            $this->city,
135 2
            $city
136
        );
137 2
        $this->city = $city;
138
139 2
        return $this;
140
    }
141
142
    /**
143
     * @return string
144
     */
145 1
    public function getCountryCode(): string
146
    {
147 1
        return $this->countryCode ?? '';
148
    }
149
150
    /**
151
     * @param string $countryCode
152
     *
153
     * @return AddressEmbeddable
154
     */
155 2
    public function setCountryCode(string $countryCode): AddressEmbeddableInterface
156
    {
157 2
        $this->notifyEmbeddablePrefixedProperties(
158 2
            'countryCode',
159 2
            $this->countryCode,
160 2
            $countryCode
161
        );
162 2
        $this->countryCode = $countryCode;
163
164 2
        return $this;
165
    }
166
167
    /**
168
     * @return string
169
     */
170 1
    public function getPostalCode(): string
171
    {
172 1
        return $this->postalCode ?? '';
173
    }
174
175
    /**
176
     * @param string $postalCode
177
     *
178
     * @return AddressEmbeddable
179
     */
180 2
    public function setPostalCode(string $postalCode): AddressEmbeddableInterface
181
    {
182 2
        $this->notifyEmbeddablePrefixedProperties(
183 2
            'postalCode',
184 2
            $this->postalCode,
185 2
            $postalCode
186
        );
187 2
        $this->postalCode = $postalCode;
188
189 2
        return $this;
190
    }
191
192
    /**
193
     * @return string
194
     */
195 1
    public function getPostalArea(): string
196
    {
197 1
        return $this->postalArea ?? '';
198
    }
199
200
    /**
201
     * @param string $postalArea
202
     *
203
     * @return AddressEmbeddable
204
     */
205 2
    public function setPostalArea(string $postalArea): AddressEmbeddableInterface
206
    {
207 2
        $this->notifyEmbeddablePrefixedProperties(
208 2
            'postalArea',
209 2
            $this->postalArea,
210 2
            $postalArea
211
        );
212 2
        $this->postalArea = $postalArea;
213
214 2
        return $this;
215
    }
216
217
    /**
218
     * @param ClassMetadata $metadata
219
     * @SuppressWarnings(PHPMD.StaticAccess)
220
     */
221 1
    public static function loadMetadata(ClassMetadata $metadata): void
222
    {
223 1
        $builder = self::setEmbeddableAndGetBuilder($metadata);
224 1
        MappingHelper::setSimpleStringFields(
225
            [
226 1
                AddressEmbeddableInterface::EMBEDDED_PROP_HOUSE_NUMBER,
227
                AddressEmbeddableInterface::EMBEDDED_PROP_HOUSE_NAME,
228
                AddressEmbeddableInterface::EMBEDDED_PROP_STREET,
229
                AddressEmbeddableInterface::EMBEDDED_PROP_CITY,
230
                AddressEmbeddableInterface::EMBEDDED_PROP_POSTAL_CODE,
231
                AddressEmbeddableInterface::EMBEDDED_PROP_POSTAL_AREA,
232
                AddressEmbeddableInterface::EMBEDDED_PROP_COUNTRY_CODE,
233
            ],
234 1
            $builder
235
        );
236 1
    }
237
238
    public function __toString(): string
239
    {
240
        return (string)print_r(
241
            [
242
                'addressEmbeddable' => [
243
                    AddressEmbeddableInterface::EMBEDDED_PROP_HOUSE_NUMBER => $this->getHouseNumber(),
244
                    AddressEmbeddableInterface::EMBEDDED_PROP_HOUSE_NAME   => $this->getHouseName(),
245
                    AddressEmbeddableInterface::EMBEDDED_PROP_STREET       => $this->getStreet(),
246
                    AddressEmbeddableInterface::EMBEDDED_PROP_CITY         => $this->getCity(),
247
                    AddressEmbeddableInterface::EMBEDDED_PROP_POSTAL_CODE  => $this->getPostalCode(),
248
                    AddressEmbeddableInterface::EMBEDDED_PROP_POSTAL_AREA  => $this->getPostalArea(),
249
                    AddressEmbeddableInterface::EMBEDDED_PROP_COUNTRY_CODE => $this->getCountryCode(),
250
                ],
251
            ], true);
252
    }
253
254 2
    protected function getPrefix(): string
255
    {
256 2
        return HasAddressEmbeddableInterface::PROP_ADDRESS_EMBEDDABLE;
257
    }
258
}
259