@@ -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 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param string $currency Authentication. |
45 | 45 | * @param int $amount Amount. |
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 | } |