greenlystapp /
basecommerce-php
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Greenlyst\BaseCommerce\Models; |
||
| 6 | |||
| 7 | use function ArrayHelpers\{array_get}; |
||
|
0 ignored issues
–
show
|
|||
| 8 | use Greenlyst\BaseCommerce\Contracts\Arrayable; |
||
| 9 | |||
| 10 | class Address extends Arrayable |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var |
||
| 14 | */ |
||
| 15 | private $name; |
||
| 16 | /** |
||
| 17 | * @var |
||
| 18 | */ |
||
| 19 | private $addressLine1; |
||
| 20 | /** |
||
| 21 | * @var |
||
| 22 | */ |
||
| 23 | private $addressLine2; |
||
| 24 | /** |
||
| 25 | * @var |
||
| 26 | */ |
||
| 27 | private $city; |
||
| 28 | /** |
||
| 29 | * @var |
||
| 30 | */ |
||
| 31 | private $state; |
||
| 32 | /** |
||
| 33 | * @var |
||
| 34 | */ |
||
| 35 | private $zipCode; |
||
| 36 | /** |
||
| 37 | * @var |
||
| 38 | */ |
||
| 39 | private $country; |
||
| 40 | |||
| 41 | const TYPE_BILLING = 'BILLING'; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @return mixed |
||
| 45 | */ |
||
| 46 | public function getName() |
||
| 47 | { |
||
| 48 | return $this->name; |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @return mixed |
||
| 53 | */ |
||
| 54 | public function getAddressLine1() |
||
| 55 | { |
||
| 56 | return $this->addressLine1; |
||
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @return mixed |
||
| 61 | */ |
||
| 62 | public function getAddressLine2() |
||
| 63 | { |
||
| 64 | return $this->addressLine2; |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @return mixed |
||
| 69 | */ |
||
| 70 | public function getCity() |
||
| 71 | { |
||
| 72 | return $this->city; |
||
| 73 | } |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @return mixed |
||
| 77 | */ |
||
| 78 | public function getState() |
||
| 79 | { |
||
| 80 | return $this->state; |
||
| 81 | } |
||
| 82 | |||
| 83 | /** |
||
| 84 | * @return mixed |
||
| 85 | */ |
||
| 86 | public function getZipCode() |
||
| 87 | { |
||
| 88 | return $this->zipCode; |
||
| 89 | } |
||
| 90 | |||
| 91 | /** |
||
| 92 | * @return mixed |
||
| 93 | */ |
||
| 94 | public function getCountry() |
||
| 95 | { |
||
| 96 | return $this->country; |
||
| 97 | } |
||
| 98 | |||
| 99 | /** |
||
| 100 | * @param mixed $name |
||
| 101 | */ |
||
| 102 | public function setName($name): void |
||
| 103 | { |
||
| 104 | $this->name = $name; |
||
| 105 | } |
||
| 106 | |||
| 107 | /** |
||
| 108 | * @param mixed $addressLine1 |
||
| 109 | */ |
||
| 110 | public function setAddressLine1($addressLine1): void |
||
| 111 | { |
||
| 112 | $this->addressLine1 = $addressLine1; |
||
| 113 | } |
||
| 114 | |||
| 115 | /** |
||
| 116 | * @param mixed $addressLine2 |
||
| 117 | */ |
||
| 118 | public function setAddressLine2($addressLine2): void |
||
| 119 | { |
||
| 120 | $this->addressLine2 = $addressLine2; |
||
| 121 | } |
||
| 122 | |||
| 123 | /** |
||
| 124 | * @param mixed $city |
||
| 125 | */ |
||
| 126 | public function setCity($city): void |
||
| 127 | { |
||
| 128 | $this->city = $city; |
||
| 129 | } |
||
| 130 | |||
| 131 | /** |
||
| 132 | * @param mixed $state |
||
| 133 | */ |
||
| 134 | public function setState($state): void |
||
| 135 | { |
||
| 136 | $this->state = $state; |
||
| 137 | } |
||
| 138 | |||
| 139 | /** |
||
| 140 | * @param mixed $zipCode |
||
| 141 | */ |
||
| 142 | public function setZipCode($zipCode): void |
||
| 143 | { |
||
| 144 | $this->zipCode = $zipCode; |
||
| 145 | } |
||
| 146 | |||
| 147 | /** |
||
| 148 | * @param mixed $country |
||
| 149 | */ |
||
| 150 | public function setCountry($country): void |
||
| 151 | { |
||
| 152 | $this->country = $country; |
||
| 153 | } |
||
| 154 | |||
| 155 | /** |
||
| 156 | * @param $data |
||
| 157 | * |
||
| 158 | * @return Address |
||
| 159 | */ |
||
| 160 | public function fromArray(array $data): self |
||
| 161 | { |
||
| 162 | $instance = new static(); |
||
| 163 | |||
| 164 | $instance->setName(array_get($data, 'address_name')); |
||
| 165 | $instance->setAddressLine1(array_get($data, 'address_line1')); |
||
| 166 | $instance->setAddressLine2(array_get($data, 'address_line2')); |
||
| 167 | $instance->setCity(array_get($data, 'address_city')); |
||
| 168 | $instance->setState(array_get($data, 'address_state')); |
||
| 169 | $instance->setZipCode(array_get($data, 'address_zipcode')); |
||
| 170 | $instance->setCountry(array_get($data, 'address_country')); |
||
| 171 | |||
| 172 | return $instance; |
||
| 173 | } |
||
| 174 | |||
| 175 | /** |
||
| 176 | * @return array |
||
| 177 | */ |
||
| 178 | public function toArray(): array |
||
| 179 | { |
||
| 180 | return clear_array([ |
||
| 181 | 'address_name' => $this->getName(), |
||
| 182 | 'address_line1' => $this->getAddressLine1(), |
||
| 183 | 'address_line2' => $this->getAddressLine2(), |
||
| 184 | 'address_city' => $this->getCity(), |
||
| 185 | 'address_state' => $this->getState(), |
||
| 186 | 'address_zipcode' => $this->getZipCode(), |
||
| 187 | 'address_country' => $this->getCountry(), |
||
| 188 | ]); |
||
| 189 | } |
||
| 190 | } |
||
| 191 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths