Issues (13)

examples/GetOrderStatus.php (1 issue)

Labels
Severity
1
<?php
2
3
use floor12\DalliApi\DalliClient;
4
use floor12\DalliApi\Enum\DalliApiEndpoint;
5
use floor12\DalliApi\Enum\DalliApiMethod;
6
use floor12\DalliApi\Models\DalliApiBody;
7
use floor12\DalliApi\OrderStatusDispatcher;
8
9
$token = 'your_token';
10
$dalliClient = new DalliClient(DalliApiEndpoint::SPB, $token);
11
12
$apiBody = new DalliApiBody(DalliApiMethod::ORDER_STATUS);
13
14
$success = $dalliClient->sendApiRequest($apiBody);
15
16
if (!$success)
17
    foreach ($dalliClient->getErrors() as $error)
18
        echo $error;
19
20
$dispatcher = new OrderStatusDispatcher($dalliClient->getResponseBody());
21
22
echo $dispatcher->getStatusId();
23
echo $dispatcher->getStatusName();
0 ignored issues
show
Are you sure the usage of $dispatcher->getStatusName() targeting floor12\DalliApi\OrderSt...atcher::getStatusName() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
24
echo $dispatcher->getStatusTimestamp();
25
26
foreach ($dispatcher->getItems() as $item) {
27
    echo $item->_barcode;
28
    echo $item->isReturned();
29
}
30