Skip to content

Commit 99c623b

Browse files
committed
Get rid of redundant array_key_exists
1 parent ecd4712 commit 99c623b

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

src/MinFraud.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -201,21 +201,21 @@ public function withDevice(
201201
}
202202
$acceptLanguage = $this->remove($values, 'accept_language');
203203
$ipAddress = $this->remove($values, 'ip_address');
204-
if (\array_key_exists('session_age', $values)) {
205-
$v = $this->remove($values, 'session_age', ['double', 'float', 'integer', 'string']);
206-
if ($v !== null) {
207-
if (!is_numeric($v)) {
208-
$this->maybeThrowInvalidInputException('Expected session_age to be a number');
209-
}
210-
$sessionAge = (float) $v;
204+
205+
$v = $this->remove($values, 'session_age', ['double', 'float', 'integer', 'string']);
206+
if ($v !== null) {
207+
if (!is_numeric($v)) {
208+
$this->maybeThrowInvalidInputException('Expected session_age to be a number');
211209
}
210+
$sessionAge = (float) $v;
212211
}
213-
if (\array_key_exists('session_id', $values)) {
214-
$v = $this->remove($values, 'session_id', ['integer', 'string']);
215-
if ($v !== null) {
216-
$sessionId = (string) $v;
217-
}
212+
213+
214+
$v = $this->remove($values, 'session_id', ['integer', 'string']);
215+
if ($v !== null) {
216+
$sessionId = (string) $v;
218217
}
218+
219219
$userAgent = $this->remove($values, 'user_agent');
220220

221221
$this->verifyEmpty($values);
@@ -1279,12 +1279,12 @@ public function withShoppingCartItem(
12791279
}
12801280

12811281
$category = $this->remove($values, 'category');
1282-
if (\array_key_exists('item_id', $values)) {
1283-
$v = $this->remove($values, 'item_id', ['integer', 'string']);
1284-
if ($v !== null) {
1285-
$itemId = (string) $v;
1286-
}
1282+
1283+
$v = $this->remove($values, 'item_id', ['integer', 'string']);
1284+
if ($v !== null) {
1285+
$itemId = (string) $v;
12871286
}
1287+
12881288
$price = $this->remove($values, 'price', ['double', 'float', 'integer']);
12891289
$quantity = $this->remove($values, 'quantity', ['integer']);
12901290

0 commit comments

Comments
 (0)