-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
Release/1.11.2
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ class Order | |
*/ | ||
public function isPaazlOrder(OrderInterface $order) | ||
{ | ||
return $this->isPaazlShippingMethod($order->getShippingMethod()); | ||
return $this->isPaazlShippingMethod((string)$order->getShippingMethod()); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Marvin-Magmodules
Author
Collaborator
|
||
} | ||
|
||
/** | ||
|
@@ -33,6 +33,9 @@ public function isPaazlOrder(OrderInterface $order) | |
*/ | ||
public function isPaazlShippingMethod(string $shippingMethod) | ||
{ | ||
if (!$shippingMethod) { | ||
This comment has been minimized.
Sorry, something went wrong.
muuk-iO
Contributor
|
||
return false; | ||
} | ||
$params = explode('_', $shippingMethod, 2); | ||
return !empty($params[0]) && ($params[0] === Paazlshipping::CODE); | ||
} | ||
|
By casting $order->getShippingMethod() to string when the value is null you will get ''. This will result in a false.
When the order is incomplete do you want to return a false? This can cause confusion.
Is my order not a paazl order or is my order incomplete. I cant know the difference.
You could throw an exception when the shippingMethod is not set. this will make clear to the programmer that there is something wrong with the order that needs to be fixed.
The false result will not break the code but could cause processing a broken order as a non paazl order.