@@ -8,12 +8,12 @@ |
||
8 | 8 | private $request; |
9 | 9 | private $response; |
10 | 10 | |
11 | - /** |
|
12 | - * @param string $message |
|
13 | - * @param int $statusCode |
|
14 | - * @param array $request |
|
15 | - * @param array $response |
|
16 | - */ |
|
11 | + /** |
|
12 | + * @param string $message |
|
13 | + * @param int $statusCode |
|
14 | + * @param array $request |
|
15 | + * @param array $response |
|
16 | + */ |
|
17 | 17 | public function __construct($message, $statusCode, $request, $response) |
18 | 18 | { |
19 | 19 | parent::__construct($message); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * @param array $request |
15 | 15 | * @param array $response |
16 | 16 | */ |
17 | - public function __construct($message, $statusCode, $request, $response) |
|
17 | + public function __construct ($message, $statusCode, $request, $response) |
|
18 | 18 | { |
19 | 19 | parent::__construct($message); |
20 | 20 | $this->statusCode = $statusCode; |
@@ -22,17 +22,17 @@ discard block |
||
22 | 22 | $this->response = $response; |
23 | 23 | } |
24 | 24 | |
25 | - public function getStatusCode() |
|
25 | + public function getStatusCode () |
|
26 | 26 | { |
27 | 27 | return $this->statusCode; |
28 | 28 | } |
29 | 29 | |
30 | - public function getRequest() |
|
30 | + public function getRequest () |
|
31 | 31 | { |
32 | 32 | return $this->request; |
33 | 33 | } |
34 | 34 | |
35 | - public function getResponse() |
|
35 | + public function getResponse () |
|
36 | 36 | { |
37 | 37 | return $this->response; |
38 | 38 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @return string |
34 | 34 | * @throws InvalidAttributeException |
35 | 35 | */ |
36 | - public function getObjectPurpose() |
|
36 | + public function getObjectPurpose () |
|
37 | 37 | { |
38 | 38 | $allowed = [static::OBJECT_PURPOSE_QUOTE, static::OBJECT_PURPOSE_PURCHASE]; |
39 | 39 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * @return string |
51 | 51 | * @throws InvalidAttributeException |
52 | 52 | */ |
53 | - public function getAddressFrom() |
|
53 | + public function getAddressFrom () |
|
54 | 54 | { |
55 | 55 | return $this->attributes->mustHave('address_from')->asString(); |
56 | 56 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @return string |
64 | 64 | * @throws InvalidAttributeException |
65 | 65 | */ |
66 | - public function getAddressTo() |
|
66 | + public function getAddressTo () |
|
67 | 67 | { |
68 | 68 | return $this->attributes->mustHave('address_to')->asString(); |
69 | 69 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @return string |
77 | 77 | * @throws InvalidAttributeException |
78 | 78 | */ |
79 | - public function getParcel() |
|
79 | + public function getParcel () |
|
80 | 80 | { |
81 | 81 | return $this->attributes->mustHave('parcel')->asString(); |
82 | 82 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @return string |
92 | 92 | * @throws InvalidAttributeException |
93 | 93 | */ |
94 | - public function getSubmissionType() |
|
94 | + public function getSubmissionType () |
|
95 | 95 | { |
96 | 96 | $allowed = [static::SUBMISSION_TYPE_DROPOFF, static::SUBMISSION_TYPE_PICKUP]; |
97 | 97 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @return string |
116 | 116 | */ |
117 | - public function getReturnOf() |
|
117 | + public function getReturnOf () |
|
118 | 118 | { |
119 | 119 | return $this->attributes->mayHave('return_of')->asString(); |
120 | 120 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @return string |
132 | 132 | * @throws InvalidAttributeException |
133 | 133 | */ |
134 | - public function getSubmissionDate() |
|
134 | + public function getSubmissionDate () |
|
135 | 135 | { |
136 | 136 | $isIOS8601Format = function ($datetime) { |
137 | 137 | // this pattern is not strict but is sufficient |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * |
160 | 160 | * @return string |
161 | 161 | */ |
162 | - public function getAddressReturn() |
|
162 | + public function getAddressReturn () |
|
163 | 163 | { |
164 | 164 | return $this->attributes->mayHave('address_return')->asString(); |
165 | 165 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * |
172 | 172 | * @return string |
173 | 173 | */ |
174 | - public function getCustomsDeclaration() |
|
174 | + public function getCustomsDeclaration () |
|
175 | 175 | { |
176 | 176 | return $this->attributes->mayHave('customs_declaration')->asString(); |
177 | 177 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * |
186 | 186 | * @return float |
187 | 187 | */ |
188 | - public function getInsuranceAmount() |
|
188 | + public function getInsuranceAmount () |
|
189 | 189 | { |
190 | 190 | return $this->attributes->mayHave('insurance_amount')->asFloat(); |
191 | 191 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * @return string |
200 | 200 | * @throws InvalidAttributeException |
201 | 201 | */ |
202 | - public function getInsuranceCurrency() |
|
202 | + public function getInsuranceCurrency () |
|
203 | 203 | { |
204 | 204 | if ($this->attributes->mayHave('insurance_amount')->value() === null) { |
205 | 205 | return $this->attributes->mayHave('insurance_currency')->asString(); |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * |
226 | 226 | * @return array |
227 | 227 | */ |
228 | - public function getExtra() |
|
228 | + public function getExtra () |
|
229 | 229 | { |
230 | 230 | return $this->attributes->mayHave('extra')->asArray(); |
231 | 231 | } |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @return string |
239 | 239 | */ |
240 | - public function getReference1() |
|
240 | + public function getReference1 () |
|
241 | 241 | { |
242 | 242 | return $this->attributes->mayHave('reference_1')->asString(); |
243 | 243 | } |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * |
250 | 250 | * @return string |
251 | 251 | */ |
252 | - public function getReference2() |
|
252 | + public function getReference2 () |
|
253 | 253 | { |
254 | 254 | return $this->attributes->mayHave('reference_2')->asString(); |
255 | 255 | } |
@@ -261,12 +261,12 @@ discard block |
||
261 | 261 | * |
262 | 262 | * @return string |
263 | 263 | */ |
264 | - public function getCarrierAccounts() |
|
264 | + public function getCarrierAccounts () |
|
265 | 265 | { |
266 | 266 | return $this->attributes->mayHave('carrier_accounts')->asArray(); |
267 | 267 | } |
268 | 268 | |
269 | - public function toArray() |
|
269 | + public function toArray () |
|
270 | 270 | { |
271 | 271 | return array_filter($this->__toArray()); |
272 | 272 | } |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use ShippoClient\Entity\Parcel; |
6 | 6 | use ShippoClient\Entity\ParcelCollection; |
7 | -use TurmericSpice\Container; |
|
8 | 7 | |
9 | 8 | class ParcelList extends ListResponse |
10 | 9 | { |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | |
16 | 16 | private static $container = []; |
17 | 17 | |
18 | - private function __construct() |
|
18 | + private function __construct () |
|
19 | 19 | { |
20 | 20 | } |
21 | 21 | |
22 | - public static function getInstance() |
|
22 | + public static function getInstance () |
|
23 | 23 | { |
24 | 24 | if (self::$instance !== null) { |
25 | 25 | return self::$instance; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | return self::$instance; |
30 | 30 | } |
31 | 31 | |
32 | - public function has($endPoint) |
|
32 | + public function has ($endPoint) |
|
33 | 33 | { |
34 | 34 | return array_key_exists($endPoint, self::$container); |
35 | 35 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @param string $endPoint |
39 | 39 | * @return MockPlugin |
40 | 40 | */ |
41 | - public function getMockResponse($endPoint) |
|
41 | + public function getMockResponse ($endPoint) |
|
42 | 42 | { |
43 | 43 | $response = new Response(self::$container[$endPoint]['statusCode']); |
44 | 44 | $response->setBody(json_encode(self::$container[$endPoint]['response'])); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | return $mock; |
49 | 49 | } |
50 | 50 | |
51 | - public function add($path, $statusCode, $response) |
|
51 | + public function add ($path, $statusCode, $response) |
|
52 | 52 | { |
53 | 53 | self::$container[$path] = [ |
54 | 54 | 'statusCode' => $statusCode, |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | return $this; |
59 | 59 | } |
60 | 60 | |
61 | - public function clear() |
|
61 | + public function clear () |
|
62 | 62 | { |
63 | 63 | self::$container = []; |
64 | 64 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | * |
15 | 15 | * @return string |
16 | 16 | */ |
17 | - public function getMetadata() |
|
17 | + public function getMetadata () |
|
18 | 18 | { |
19 | 19 | return $this->attributes->mayHave('metadata')->asString(function ($metadata) { |
20 | 20 | return mb_strlen($metadata) <= 100; |
@@ -20,7 +20,7 @@ |
||
20 | 20 | * @return string |
21 | 21 | * @throws InvalidAttributeException |
22 | 22 | */ |
23 | - public function getRate() |
|
23 | + public function getRate () |
|
24 | 24 | { |
25 | 25 | return $this->attributes->mustHave('rate')->asString(); |
26 | 26 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @return int |
30 | 30 | * @throws InvalidAttributeException |
31 | 31 | */ |
32 | - public function getLength() |
|
32 | + public function getLength () |
|
33 | 33 | { |
34 | 34 | return $this->attributes->mustHave('length')->asInteger(); |
35 | 35 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @return int |
46 | 46 | * @throws InvalidAttributeException |
47 | 47 | */ |
48 | - public function getWidth() |
|
48 | + public function getWidth () |
|
49 | 49 | { |
50 | 50 | return $this->attributes->mustHave('width')->asInteger(); |
51 | 51 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @return int |
62 | 62 | * @throws InvalidAttributeException |
63 | 63 | */ |
64 | - public function getHeight() |
|
64 | + public function getHeight () |
|
65 | 65 | { |
66 | 66 | return $this->attributes->mustHave('height')->asInteger(); |
67 | 67 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @return string |
75 | 75 | * @throws InvalidAttributeException |
76 | 76 | */ |
77 | - public function getDistanceUnit() |
|
77 | + public function getDistanceUnit () |
|
78 | 78 | { |
79 | 79 | return $this->attributes->mustHave('distance_unit')->asString(function ($distanceUnit) { |
80 | 80 | return in_array($distanceUnit, ['cm', 'in', 'ft', 'mm', 'm', 'yd'], true); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return int |
90 | 90 | * @throws InvalidAttributeException |
91 | 91 | */ |
92 | - public function getWeight() |
|
92 | + public function getWeight () |
|
93 | 93 | { |
94 | 94 | return $this->attributes->mustHave('weight')->asInteger(); |
95 | 95 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @return string |
103 | 103 | * @throws InvalidAttributeException |
104 | 104 | */ |
105 | - public function getMassUnit() |
|
105 | + public function getMassUnit () |
|
106 | 106 | { |
107 | 107 | return $this->attributes->mustHave('mass_unit')->asString(function ($massUnit) { |
108 | 108 | return in_array($massUnit, ['g', 'oz', 'lb', 'kg'], true); |
@@ -119,12 +119,12 @@ discard block |
||
119 | 119 | * |
120 | 120 | * @return string |
121 | 121 | */ |
122 | - public function getTemplate() |
|
122 | + public function getTemplate () |
|
123 | 123 | { |
124 | 124 | return $this->attributes->mayHave('template')->asString(); |
125 | 125 | } |
126 | 126 | |
127 | - public function toArray() |
|
127 | + public function toArray () |
|
128 | 128 | { |
129 | 129 | return array_filter($this->__toArray()); |
130 | 130 | } |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use ShippoClient\Entity\Parcel; |
6 | 6 | use ShippoClient\Entity\ParcelCollection; |
7 | -use TurmericSpice\Container; |
|
8 | 7 | |
9 | 8 | class ParcelList extends ListResponse |
10 | 9 | { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @return string |
33 | 33 | * @throws InvalidAttributeException |
34 | 34 | */ |
35 | - public function getObjectPurpose() |
|
35 | + public function getObjectPurpose () |
|
36 | 36 | { |
37 | 37 | $allowed = [static::OBJECT_PURPOSE_QUOTE, static::OBJECT_PURPOSE_PURCHASE]; |
38 | 38 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @return string |
50 | 50 | * @throws InvalidAttributeException |
51 | 51 | */ |
52 | - public function getName() |
|
52 | + public function getName () |
|
53 | 53 | { |
54 | 54 | if ($this->getObjectPurpose() === static::OBJECT_PURPOSE_PURCHASE) { |
55 | 55 | return $this->attributes->mustHave('name')->asString(); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return string |
66 | 66 | */ |
67 | - public function getCompany() |
|
67 | + public function getCompany () |
|
68 | 68 | { |
69 | 69 | return $this->attributes->mayHave('company')->asString(); |
70 | 70 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @return string |
79 | 79 | * @throws InvalidAttributeException |
80 | 80 | */ |
81 | - public function getStreet1() |
|
81 | + public function getStreet1 () |
|
82 | 82 | { |
83 | 83 | if ($this->getObjectPurpose() === static::OBJECT_PURPOSE_PURCHASE) { |
84 | 84 | return $this->attributes->mustHave('street1')->asString(); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @return string |
96 | 96 | */ |
97 | - public function getStreetNo() |
|
97 | + public function getStreetNo () |
|
98 | 98 | { |
99 | 99 | return $this->attributes->mayHave('street_no')->asString(); |
100 | 100 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @return string |
108 | 108 | */ |
109 | - public function getStreet2() |
|
109 | + public function getStreet2 () |
|
110 | 110 | { |
111 | 111 | return $this->attributes->mayHave('street2')->asString(); |
112 | 112 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * @return string |
122 | 122 | * @throws InvalidAttributeException |
123 | 123 | */ |
124 | - public function getCity() |
|
124 | + public function getCity () |
|
125 | 125 | { |
126 | 126 | if ($this->getObjectPurpose() === static::OBJECT_PURPOSE_PURCHASE) { |
127 | 127 | return $this->attributes->mustHave('city')->asString(); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @return string |
139 | 139 | * @throws InvalidAttributeException |
140 | 140 | */ |
141 | - public function getZip() |
|
141 | + public function getZip () |
|
142 | 142 | { |
143 | 143 | if ($this->getObjectPurpose() === static::OBJECT_PURPOSE_PURCHASE) { |
144 | 144 | return $this->attributes->mustHave('zip')->asString(); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * @return string |
157 | 157 | * @throws InvalidAttributeException |
158 | 158 | */ |
159 | - public function getState() |
|
159 | + public function getState () |
|
160 | 160 | { |
161 | 161 | if (in_array($this->getCountry(), ['US', 'CA'], true)) { |
162 | 162 | return $this->attributes->mustHave('state')->asString(); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @return string |
175 | 175 | * @throws InvalidAttributeException |
176 | 176 | */ |
177 | - public function getCountry() |
|
177 | + public function getCountry () |
|
178 | 178 | { |
179 | 179 | return $this->attributes->mustHave('country')->asString(function ($country) { |
180 | 180 | return (bool)preg_match('/^[A-Z]{2}$/', $country); |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @return string |
191 | 191 | * @throws InvalidAttributeException |
192 | 192 | */ |
193 | - public function getPhone() |
|
193 | + public function getPhone () |
|
194 | 194 | { |
195 | 195 | return $this->attributes->mayHave('phone')->asString(); |
196 | 196 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @return string |
204 | 204 | * @throws InvalidAttributeException |
205 | 205 | */ |
206 | - public function getEmail() |
|
206 | + public function getEmail () |
|
207 | 207 | { |
208 | 208 | $validation = function ($email) { |
209 | 209 | return filter_var($email, FILTER_VALIDATE_EMAIL); |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @return null|bool |
223 | 223 | */ |
224 | - public function getIsResidential() |
|
224 | + public function getIsResidential () |
|
225 | 225 | { |
226 | 226 | $is_residential = $this->attributes->mayHave('is_residential')->value(); |
227 | 227 | if ($is_residential === null) { |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | return (bool)$is_residential; |
232 | 232 | } |
233 | 233 | |
234 | - public function toArray() |
|
234 | + public function toArray () |
|
235 | 235 | { |
236 | 236 | return array_filter($this->__toArray()); |
237 | 237 | } |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use ShippoClient\Entity\Parcel; |
6 | 6 | use ShippoClient\Entity\ParcelCollection; |
7 | -use TurmericSpice\Container; |
|
8 | 7 | |
9 | 8 | class ParcelList extends ListResponse |
10 | 9 | { |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return mixed|null |
50 | 50 | */ |
51 | - public function getAvailableShippo() |
|
51 | + public function getAvailableShippo () |
|
52 | 52 | { |
53 | 53 | return $this->attributes->mayHave('available_shippo')->value(); |
54 | 54 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @return mixed|null |
60 | 60 | */ |
61 | - public function getOutboundEndpoint() |
|
61 | + public function getOutboundEndpoint () |
|
62 | 62 | { |
63 | 63 | return $this->attributes->mayHave('outbound_endpoint')->value(); |
64 | 64 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @return mixed|null |
70 | 70 | */ |
71 | - public function getInboundEndpoint() |
|
71 | + public function getInboundEndpoint () |
|
72 | 72 | { |
73 | 73 | return $this->attributes->mayHave('inbound_endpoint')->value(); |
74 | 74 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @return mixed|null |
80 | 80 | */ |
81 | - public function getArrivesBy() |
|
81 | + public function getArrivesBy () |
|
82 | 82 | { |
83 | 83 | return $this->attributes->mayHave('arrives_by')->value(); |
84 | 84 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return mixed|null |
90 | 90 | */ |
91 | - public function getDeliveryAttempts() |
|
91 | + public function getDeliveryAttempts () |
|
92 | 92 | { |
93 | 93 | return $this->attributes->mayHave('delivery_attempts')->value(); |
94 | 94 | } |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use ShippoClient\Entity\Parcel; |
6 | 6 | use ShippoClient\Entity\ParcelCollection; |
7 | -use TurmericSpice\Container; |
|
8 | 7 | |
9 | 8 | class ParcelList extends ListResponse |
10 | 9 | { |
@@ -19,7 +19,7 @@ |
||
19 | 19 | * |
20 | 20 | * @return string |
21 | 21 | */ |
22 | - public function getObjectStatus() |
|
22 | + public function getObjectStatus () |
|
23 | 23 | { |
24 | 24 | return $this->attributes->mayHave('object_status')->asString(); |
25 | 25 | } |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use ShippoClient\Entity\Parcel; |
6 | 6 | use ShippoClient\Entity\ParcelCollection; |
7 | -use TurmericSpice\Container; |
|
8 | 7 | |
9 | 8 | class ParcelList extends ListResponse |
10 | 9 | { |