@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @param Money $paid_amount Paid amount. |
96 | 96 | * @param Money $total_amount Total amount. |
97 | 97 | */ |
98 | - public function __construct( $merchant_order_id, $omnikassa_order_id, $poi_id, $order_status, $order_status_datetime, $error_code, Money $paid_amount, Money $total_amount ) { |
|
98 | + public function __construct($merchant_order_id, $omnikassa_order_id, $poi_id, $order_status, $order_status_datetime, $error_code, Money $paid_amount, Money $total_amount) { |
|
99 | 99 | $this->merchant_order_id = $merchant_order_id; |
100 | 100 | $this->omnikassa_order_id = $omnikassa_order_id; |
101 | 101 | $this->poi_id = $poi_id; |
@@ -203,37 +203,37 @@ discard block |
||
203 | 203 | * @return OrderResult |
204 | 204 | * @throws InvalidArgumentException Throws invalid argument exception when object does not contains the required properties. |
205 | 205 | */ |
206 | - public static function from_object( stdClass $object ) { |
|
207 | - if ( ! isset( $object->merchantOrderId ) ) { |
|
208 | - throw new InvalidArgumentException( 'Object must contain `merchantOrderId` property.' ); |
|
206 | + public static function from_object(stdClass $object) { |
|
207 | + if ( ! isset($object->merchantOrderId)) { |
|
208 | + throw new InvalidArgumentException('Object must contain `merchantOrderId` property.'); |
|
209 | 209 | } |
210 | 210 | |
211 | - if ( ! isset( $object->omnikassaOrderId ) ) { |
|
212 | - throw new InvalidArgumentException( 'Object must contain `omnikassaOrderId` property.' ); |
|
211 | + if ( ! isset($object->omnikassaOrderId)) { |
|
212 | + throw new InvalidArgumentException('Object must contain `omnikassaOrderId` property.'); |
|
213 | 213 | } |
214 | 214 | |
215 | - if ( ! isset( $object->poiId ) ) { |
|
216 | - throw new InvalidArgumentException( 'Object must contain `poiId` property.' ); |
|
215 | + if ( ! isset($object->poiId)) { |
|
216 | + throw new InvalidArgumentException('Object must contain `poiId` property.'); |
|
217 | 217 | } |
218 | 218 | |
219 | - if ( ! isset( $object->orderStatus ) ) { |
|
220 | - throw new InvalidArgumentException( 'Object must contain `orderStatus` property.' ); |
|
219 | + if ( ! isset($object->orderStatus)) { |
|
220 | + throw new InvalidArgumentException('Object must contain `orderStatus` property.'); |
|
221 | 221 | } |
222 | 222 | |
223 | - if ( ! isset( $object->orderStatusDateTime ) ) { |
|
224 | - throw new InvalidArgumentException( 'Object must contain `orderStatusDateTime` property.' ); |
|
223 | + if ( ! isset($object->orderStatusDateTime)) { |
|
224 | + throw new InvalidArgumentException('Object must contain `orderStatusDateTime` property.'); |
|
225 | 225 | } |
226 | 226 | |
227 | - if ( ! isset( $object->errorCode ) ) { |
|
228 | - throw new InvalidArgumentException( 'Object must contain `errorCode` property.' ); |
|
227 | + if ( ! isset($object->errorCode)) { |
|
228 | + throw new InvalidArgumentException('Object must contain `errorCode` property.'); |
|
229 | 229 | } |
230 | 230 | |
231 | - if ( ! isset( $object->paidAmount ) ) { |
|
232 | - throw new InvalidArgumentException( 'Object must contain `paidAmount` property.' ); |
|
231 | + if ( ! isset($object->paidAmount)) { |
|
232 | + throw new InvalidArgumentException('Object must contain `paidAmount` property.'); |
|
233 | 233 | } |
234 | 234 | |
235 | - if ( ! isset( $object->totalAmount ) ) { |
|
236 | - throw new InvalidArgumentException( 'Object must contain `totalAmount` property.' ); |
|
235 | + if ( ! isset($object->totalAmount)) { |
|
236 | + throw new InvalidArgumentException('Object must contain `totalAmount` property.'); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | return new self( |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | $object->orderStatus, |
244 | 244 | $object->orderStatusDateTime, |
245 | 245 | $object->errorCode, |
246 | - Money::from_object( $object->paidAmount ), |
|
247 | - Money::from_object( $object->totalAmount ) |
|
246 | + Money::from_object($object->paidAmount), |
|
247 | + Money::from_object($object->totalAmount) |
|
248 | 248 | ); |
249 | 249 | } |
250 | 250 | |
@@ -255,19 +255,19 @@ discard block |
||
255 | 255 | * @return OrderResult |
256 | 256 | * @throws \JsonSchema\Exception\ValidationException Throws JSON schema validation exception when JSON is invalid. |
257 | 257 | */ |
258 | - public static function from_json( $json ) { |
|
259 | - $data = json_decode( $json ); |
|
258 | + public static function from_json($json) { |
|
259 | + $data = json_decode($json); |
|
260 | 260 | |
261 | 261 | $validator = new Validator(); |
262 | 262 | |
263 | 263 | $validator->validate( |
264 | 264 | $data, |
265 | 265 | (object) array( |
266 | - '$ref' => 'file://' . realpath( __DIR__ . '/../json-schemas/json-schema-order-result.json' ), |
|
266 | + '$ref' => 'file://' . realpath(__DIR__ . '/../json-schemas/json-schema-order-result.json'), |
|
267 | 267 | ), |
268 | 268 | Constraint::CHECK_MODE_EXCEPTIONS |
269 | 269 | ); |
270 | 270 | |
271 | - return self::from_object( $data ); |
|
271 | + return self::from_object($data); |
|
272 | 272 | } |
273 | 273 | } |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | * @param int|string $poi_id POI ID. |
62 | 62 | * @param string $signature Signature. |
63 | 63 | */ |
64 | - public function __construct( $authentication, $expiry, $event_name, $poi_id, $signature ) { |
|
65 | - parent::__construct( $signature ); |
|
64 | + public function __construct($authentication, $expiry, $event_name, $poi_id, $signature) { |
|
65 | + parent::__construct($signature); |
|
66 | 66 | |
67 | 67 | $this->authentication = $authentication; |
68 | 68 | $this->expiry = $expiry; |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | * @return bool True if notice authentication token is epxired, false otherwise. |
95 | 95 | */ |
96 | 96 | public function is_expired() { |
97 | - $timestamp = strtotime( $this->get_expiry() ); |
|
97 | + $timestamp = strtotime($this->get_expiry()); |
|
98 | 98 | |
99 | - if ( false === $timestamp ) { |
|
99 | + if (false === $timestamp) { |
|
100 | 100 | return true; |
101 | 101 | } |
102 | 102 | |
@@ -142,25 +142,25 @@ discard block |
||
142 | 142 | * @return Notification |
143 | 143 | * @throws InvalidArgumentException Throws invalid argument exception when object does not contains the required properties. |
144 | 144 | */ |
145 | - public static function from_object( stdClass $object ) { |
|
146 | - if ( ! isset( $object->signature ) ) { |
|
147 | - throw new InvalidArgumentException( 'Object must contain `signature` property.' ); |
|
145 | + public static function from_object(stdClass $object) { |
|
146 | + if ( ! isset($object->signature)) { |
|
147 | + throw new InvalidArgumentException('Object must contain `signature` property.'); |
|
148 | 148 | } |
149 | 149 | |
150 | - if ( ! isset( $object->authentication ) ) { |
|
151 | - throw new InvalidArgumentException( 'Object must contain `authentication` property.' ); |
|
150 | + if ( ! isset($object->authentication)) { |
|
151 | + throw new InvalidArgumentException('Object must contain `authentication` property.'); |
|
152 | 152 | } |
153 | 153 | |
154 | - if ( ! isset( $object->expiry ) ) { |
|
155 | - throw new InvalidArgumentException( 'Object must contain `expiry` property.' ); |
|
154 | + if ( ! isset($object->expiry)) { |
|
155 | + throw new InvalidArgumentException('Object must contain `expiry` property.'); |
|
156 | 156 | } |
157 | 157 | |
158 | - if ( ! isset( $object->eventName ) ) { |
|
159 | - throw new InvalidArgumentException( 'Object must contain `eventName` property.' ); |
|
158 | + if ( ! isset($object->eventName)) { |
|
159 | + throw new InvalidArgumentException('Object must contain `eventName` property.'); |
|
160 | 160 | } |
161 | 161 | |
162 | - if ( ! isset( $object->poiId ) ) { |
|
163 | - throw new InvalidArgumentException( 'Object must contain `poiId` property.' ); |
|
162 | + if ( ! isset($object->poiId)) { |
|
163 | + throw new InvalidArgumentException('Object must contain `poiId` property.'); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | return new self( |
@@ -179,19 +179,19 @@ discard block |
||
179 | 179 | * @return Notification |
180 | 180 | * @throws \JsonSchema\Exception\ValidationException Throws JSON schema validation exception when JSON is invalid. |
181 | 181 | */ |
182 | - public static function from_json( $json ) { |
|
183 | - $data = json_decode( $json ); |
|
182 | + public static function from_json($json) { |
|
183 | + $data = json_decode($json); |
|
184 | 184 | |
185 | 185 | $validator = new Validator(); |
186 | 186 | |
187 | 187 | $validator->validate( |
188 | 188 | $data, |
189 | 189 | (object) array( |
190 | - '$ref' => 'file://' . realpath( __DIR__ . '/../json-schemas/notification.json' ), |
|
190 | + '$ref' => 'file://' . realpath(__DIR__ . '/../json-schemas/notification.json'), |
|
191 | 191 | ), |
192 | 192 | Constraint::CHECK_MODE_EXCEPTIONS |
193 | 193 | ); |
194 | 194 | |
195 | - return self::from_object( $data ); |
|
195 | + return self::from_object($data); |
|
196 | 196 | } |
197 | 197 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param string $code Code. |
46 | 46 | * @param string $message Message. |
47 | 47 | */ |
48 | - public function __construct( $code, $message ) { |
|
48 | + public function __construct($code, $message) { |
|
49 | 49 | $this->code = $code; |
50 | 50 | $this->message = $message; |
51 | 51 | } |
@@ -75,18 +75,18 @@ discard block |
||
75 | 75 | * @return Error |
76 | 76 | * @throws InvalidArgumentException Throws invalid argument exception when object does not contains the required properties. |
77 | 77 | */ |
78 | - public static function from_object( stdClass $object ) { |
|
79 | - if ( ! isset( $object->errorCode ) ) { |
|
80 | - throw new InvalidArgumentException( 'Object must contain `errorCode` property.' ); |
|
78 | + public static function from_object(stdClass $object) { |
|
79 | + if ( ! isset($object->errorCode)) { |
|
80 | + throw new InvalidArgumentException('Object must contain `errorCode` property.'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | $message = null; |
84 | 84 | |
85 | - if ( isset( $object->errorMessage ) ) { |
|
85 | + if (isset($object->errorMessage)) { |
|
86 | 86 | $message = $object->errorMessage; |
87 | 87 | } |
88 | 88 | |
89 | - if ( isset( $object->consumerMessage ) ) { |
|
89 | + if (isset($object->consumerMessage)) { |
|
90 | 90 | $message = $object->consumerMessage; |
91 | 91 | } |
92 | 92 | |
@@ -103,19 +103,19 @@ discard block |
||
103 | 103 | * @return Error |
104 | 104 | * @throws \JsonSchema\Exception\ValidationException Throws JSON schema validation exception when JSON is invalid. |
105 | 105 | */ |
106 | - public static function from_json( $json ) { |
|
107 | - $data = json_decode( $json ); |
|
106 | + public static function from_json($json) { |
|
107 | + $data = json_decode($json); |
|
108 | 108 | |
109 | 109 | $validator = new Validator(); |
110 | 110 | |
111 | 111 | $validator->validate( |
112 | 112 | $data, |
113 | 113 | (object) array( |
114 | - '$ref' => 'file://' . realpath( __DIR__ . '/../json-schemas/json-schema-error.json' ), |
|
114 | + '$ref' => 'file://' . realpath(__DIR__ . '/../json-schemas/json-schema-error.json'), |
|
115 | 115 | ), |
116 | 116 | Constraint::CHECK_MODE_EXCEPTIONS |
117 | 117 | ); |
118 | 118 | |
119 | - return self::from_object( $data ); |
|
119 | + return self::from_object($data); |
|
120 | 120 | } |
121 | 121 | } |
@@ -26,16 +26,16 @@ |
||
26 | 26 | * @param string $post_id Post ID. |
27 | 27 | * @return Config |
28 | 28 | */ |
29 | - public function get_config( $post_id ) { |
|
29 | + public function get_config($post_id) { |
|
30 | 30 | $config = new Config(); |
31 | 31 | |
32 | - $config->post_id = intval( $post_id ); |
|
33 | - $config->mode = $this->get_meta( $post_id, 'mode' ); |
|
34 | - $config->refresh_token = $this->get_meta( $post_id, 'omnikassa_2_refresh_token' ); |
|
35 | - $config->signing_key = $this->get_meta( $post_id, 'omnikassa_2_signing_key' ); |
|
36 | - $config->access_token = $this->get_meta( $post_id, 'omnikassa_2_access_token' ); |
|
37 | - $config->access_token_valid_until = $this->get_meta( $post_id, 'omnikassa_2_access_token_valid_until' ); |
|
38 | - $config->order_id = $this->get_meta( $post_id, 'omnikassa_2_order_id' ); |
|
32 | + $config->post_id = intval($post_id); |
|
33 | + $config->mode = $this->get_meta($post_id, 'mode'); |
|
34 | + $config->refresh_token = $this->get_meta($post_id, 'omnikassa_2_refresh_token'); |
|
35 | + $config->signing_key = $this->get_meta($post_id, 'omnikassa_2_signing_key'); |
|
36 | + $config->access_token = $this->get_meta($post_id, 'omnikassa_2_access_token'); |
|
37 | + $config->access_token_valid_until = $this->get_meta($post_id, 'omnikassa_2_access_token_valid_until'); |
|
38 | + $config->order_id = $this->get_meta($post_id, 'omnikassa_2_order_id'); |
|
39 | 39 | |
40 | 40 | return $config; |
41 | 41 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * |
105 | 105 | * @param string $first_name First name. |
106 | 106 | */ |
107 | - public function set_first_name( $first_name ) { |
|
107 | + public function set_first_name($first_name) { |
|
108 | 108 | $this->first_name = $first_name; |
109 | 109 | } |
110 | 110 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * |
123 | 123 | * @param string $middle_name Middle name. |
124 | 124 | */ |
125 | - public function set_middle_name( $middle_name ) { |
|
125 | + public function set_middle_name($middle_name) { |
|
126 | 126 | $this->middle_name = $middle_name; |
127 | 127 | } |
128 | 128 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * |
141 | 141 | * @param string $last_name Last name. |
142 | 142 | */ |
143 | - public function set_last_name( $last_name ) { |
|
143 | + public function set_last_name($last_name) { |
|
144 | 144 | $this->last_name = $last_name; |
145 | 145 | } |
146 | 146 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @param string $street Street. |
160 | 160 | */ |
161 | - public function set_street( $street ) { |
|
161 | + public function set_street($street) { |
|
162 | 162 | $this->street = $street; |
163 | 163 | } |
164 | 164 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @param string $house_number House number. |
178 | 178 | */ |
179 | - public function set_house_number( $house_number ) { |
|
179 | + public function set_house_number($house_number) { |
|
180 | 180 | $this->house_number = $house_number; |
181 | 181 | } |
182 | 182 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * |
195 | 195 | * @param string $house_number_addition House number addition. |
196 | 196 | */ |
197 | - public function set_house_number_addition( $house_number_addition ) { |
|
197 | + public function set_house_number_addition($house_number_addition) { |
|
198 | 198 | $this->house_number_addition = $house_number_addition; |
199 | 199 | } |
200 | 200 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * |
213 | 213 | * @param string $postal_code Postal code. |
214 | 214 | */ |
215 | - public function set_postal_code( $postal_code ) { |
|
215 | + public function set_postal_code($postal_code) { |
|
216 | 216 | $this->postal_code = $postal_code; |
217 | 217 | } |
218 | 218 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * |
231 | 231 | * @param string $city City. |
232 | 232 | */ |
233 | - public function set_city( $city ) { |
|
233 | + public function set_city($city) { |
|
234 | 234 | $this->city = $city; |
235 | 235 | } |
236 | 236 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * |
249 | 249 | * @param string $country_code Country code. |
250 | 250 | */ |
251 | - public function set_country_code( $country_code ) { |
|
251 | + public function set_country_code($country_code) { |
|
252 | 252 | $this->country_code = $country_code; |
253 | 253 | } |
254 | 254 | |
@@ -270,9 +270,9 @@ discard block |
||
270 | 270 | 'countryCode' => $this->country_code, |
271 | 271 | ); |
272 | 272 | |
273 | - $data = array_filter( $data ); |
|
273 | + $data = array_filter($data); |
|
274 | 274 | |
275 | - if ( empty( $data ) ) { |
|
275 | + if (empty($data)) { |
|
276 | 276 | return null; |
277 | 277 | } |
278 | 278 | |
@@ -294,11 +294,11 @@ discard block |
||
294 | 294 | ); |
295 | 295 | |
296 | 296 | // Optional house number fields. |
297 | - if ( null !== $this->house_number ) { |
|
297 | + if (null !== $this->house_number) { |
|
298 | 298 | $data[] = $this->house_number; |
299 | 299 | } |
300 | 300 | |
301 | - if ( null !== $this->house_number_addition ) { |
|
301 | + if (null !== $this->house_number_addition) { |
|
302 | 302 | $data[] = $this->house_number_addition; |
303 | 303 | } |
304 | 304 |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param string $currency Authentication. |
45 | 45 | * @param int $amount Amount in cents. |
46 | 46 | */ |
47 | - public function __construct( $currency, $amount ) { |
|
47 | + public function __construct($currency, $amount) { |
|
48 | 48 | $this->currency = $currency; |
49 | 49 | $this->amount = $amount; |
50 | 50 | } |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | * @return Money |
87 | 87 | * @throws InvalidArgumentException Throws invalid argument exception when object does not contains the required properties. |
88 | 88 | */ |
89 | - public static function from_object( stdClass $object ) { |
|
90 | - if ( ! isset( $object->currency ) ) { |
|
91 | - throw new InvalidArgumentException( 'Object must contain `currency` property.' ); |
|
89 | + public static function from_object(stdClass $object) { |
|
90 | + if ( ! isset($object->currency)) { |
|
91 | + throw new InvalidArgumentException('Object must contain `currency` property.'); |
|
92 | 92 | } |
93 | 93 | |
94 | - if ( ! isset( $object->amount ) ) { |
|
95 | - throw new InvalidArgumentException( 'Object must contain `amount` property.' ); |
|
94 | + if ( ! isset($object->amount)) { |
|
95 | + throw new InvalidArgumentException('Object must contain `amount` property.'); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | return new self( |
@@ -108,19 +108,19 @@ discard block |
||
108 | 108 | * @return Money |
109 | 109 | * @throws \JsonSchema\Exception\ValidationException Throws JSON schema validation exception when JSON is invalid. |
110 | 110 | */ |
111 | - public static function from_json( $json ) { |
|
112 | - $data = json_decode( $json ); |
|
111 | + public static function from_json($json) { |
|
112 | + $data = json_decode($json); |
|
113 | 113 | |
114 | 114 | $validator = new Validator(); |
115 | 115 | |
116 | 116 | $validator->validate( |
117 | 117 | $data, |
118 | 118 | (object) array( |
119 | - '$ref' => 'file://' . realpath( __DIR__ . '/../json-schemas/json-schema-money.json' ), |
|
119 | + '$ref' => 'file://' . realpath(__DIR__ . '/../json-schemas/json-schema-money.json'), |
|
120 | 120 | ), |
121 | 121 | Constraint::CHECK_MODE_EXCEPTIONS |
122 | 122 | ); |
123 | 123 | |
124 | - return self::from_object( $data ); |
|
124 | + return self::from_object($data); |
|
125 | 125 | } |
126 | 126 | } |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @param array $items Order items. |
32 | 32 | */ |
33 | - public function __construct( $items = null ) { |
|
34 | - if ( is_array( $items ) ) { |
|
35 | - foreach ( $items as $item ) { |
|
36 | - $this->add_item( $item ); |
|
33 | + public function __construct($items = null) { |
|
34 | + if (is_array($items)) { |
|
35 | + foreach ($items as $item) { |
|
36 | + $this->add_item($item); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | } |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @return void |
47 | 47 | */ |
48 | - public function add_item( $order_item ) { |
|
49 | - if ( ! ( $order_item instanceof OrderItem ) ) { |
|
50 | - $order_item = new OrderItem( $order_item ); |
|
48 | + public function add_item($order_item) { |
|
49 | + if ( ! ($order_item instanceof OrderItem)) { |
|
50 | + $order_item = new OrderItem($order_item); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | $this->order_items[] = $order_item; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | $items = $this->get_order_items(); |
74 | 74 | |
75 | - foreach ( $items as $item ) { |
|
75 | + foreach ($items as $item) { |
|
76 | 76 | $amount = $item->get_amount(); |
77 | 77 | $tax = $item->get_tax(); |
78 | 78 | |
@@ -81,20 +81,20 @@ discard block |
||
81 | 81 | 'name' => $item->get_name(), |
82 | 82 | 'description' => $item->get_description(), |
83 | 83 | 'quantity' => $item->get_quantity(), |
84 | - 'amount' => ( $amount instanceof Money ) ? $amount->get_json() : null, |
|
85 | - 'tax' => ( $tax instanceof Money ) ? $tax->get_json() : null, |
|
84 | + 'amount' => ($amount instanceof Money) ? $amount->get_json() : null, |
|
85 | + 'tax' => ($tax instanceof Money) ? $tax->get_json() : null, |
|
86 | 86 | 'category' => $item->get_category(), |
87 | 87 | 'vatCategory' => $item->get_vat_category(), |
88 | 88 | ); |
89 | 89 | |
90 | - $item_data = array_filter( $item_data ); |
|
90 | + $item_data = array_filter($item_data); |
|
91 | 91 | |
92 | - if ( ! empty( $item_data ) ) { |
|
92 | + if ( ! empty($item_data)) { |
|
93 | 93 | $data[] = (object) $item_data; |
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
97 | - if ( empty( $data ) ) { |
|
97 | + if (empty($data)) { |
|
98 | 98 | return null; |
99 | 99 | } |
100 | 100 | |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | |
112 | 112 | $order_items = $this->get_order_items(); |
113 | 113 | |
114 | - foreach ( $order_items as $item ) { |
|
114 | + foreach ($order_items as $item) { |
|
115 | 115 | // Optional ID. |
116 | 116 | $item_id = $item->get_id(); |
117 | 117 | |
118 | - if ( ! empty( $item_id ) ) { |
|
118 | + if ( ! empty($item_id)) { |
|
119 | 119 | $data[] = $item_id; |
120 | 120 | } |
121 | 121 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | // Required tax field. |
130 | 130 | $tax = $item->get_tax(); |
131 | 131 | |
132 | - if ( empty( $tax ) ) { |
|
132 | + if (empty($tax)) { |
|
133 | 133 | $data[] = $tax; |
134 | 134 | } else { |
135 | 135 | $data[] = $tax->get_currency(); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | // Optional VAT category. |
143 | 143 | $vat_category = $item->get_vat_category(); |
144 | 144 | |
145 | - if ( ! empty( $vat_category ) ) { |
|
145 | + if ( ! empty($vat_category)) { |
|
146 | 146 | $data[] = $vat_category; |
147 | 147 | } |
148 | 148 | } |
@@ -113,13 +113,13 @@ |
||
113 | 113 | * |
114 | 114 | * @return string|null |
115 | 115 | */ |
116 | - public static function transform( $payment_method, $default = null ) { |
|
117 | - if ( ! is_scalar( $payment_method ) ) { |
|
116 | + public static function transform($payment_method, $default = null) { |
|
117 | + if ( ! is_scalar($payment_method)) { |
|
118 | 118 | return null; |
119 | 119 | } |
120 | 120 | |
121 | - if ( isset( self::$map[ $payment_method ] ) ) { |
|
122 | - return self::$map[ $payment_method ]; |
|
121 | + if (isset(self::$map[$payment_method])) { |
|
122 | + return self::$map[$payment_method]; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | return $default; |
@@ -81,37 +81,37 @@ |
||
81 | 81 | * |
82 | 82 | * @return self |
83 | 83 | */ |
84 | - public function __construct( array $item ) { |
|
85 | - if ( isset( $item['id'] ) ) { |
|
84 | + public function __construct(array $item) { |
|
85 | + if (isset($item['id'])) { |
|
86 | 86 | $this->id = $item['id']; |
87 | 87 | } |
88 | 88 | |
89 | - if ( isset( $item['name'] ) ) { |
|
89 | + if (isset($item['name'])) { |
|
90 | 90 | $this->name = $item['name']; |
91 | 91 | } |
92 | 92 | |
93 | - if ( isset( $item['description'] ) ) { |
|
93 | + if (isset($item['description'])) { |
|
94 | 94 | $this->description = $item['description']; |
95 | 95 | } |
96 | 96 | |
97 | - if ( isset( $item['quantity'] ) ) { |
|
98 | - $this->quantity = intval( $item['quantity'] ); |
|
97 | + if (isset($item['quantity'])) { |
|
98 | + $this->quantity = intval($item['quantity']); |
|
99 | 99 | } |
100 | 100 | |
101 | - if ( isset( $item['amount'] ) ) { |
|
101 | + if (isset($item['amount'])) { |
|
102 | 102 | $this->amount = $item['amount']; |
103 | 103 | } |
104 | 104 | |
105 | - if ( isset( $item['tax'] ) ) { |
|
105 | + if (isset($item['tax'])) { |
|
106 | 106 | $this->tax = $item['tax']; |
107 | 107 | } |
108 | 108 | |
109 | - if ( isset( $item['category'] ) ) { |
|
109 | + if (isset($item['category'])) { |
|
110 | 110 | $this->category = $item['category']; |
111 | 111 | } |
112 | 112 | |
113 | - if ( isset( $item['vat_category'] ) ) { |
|
114 | - $this->vat_category = intval( $item['vat_category'] ); |
|
113 | + if (isset($item['vat_category'])) { |
|
114 | + $this->vat_category = intval($item['vat_category']); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 |