Test Failed
Pull Request — master (#46)
by Yuji
04:29
created

SearchOrdersApi::distillResponse()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 6
nc 3
nop 1
1
<?php
2
3
namespace Shippinno\YahooShoppingJp\Api;
4
5
use Shippinno\YahooShoppingJp\HttpMethod;
6
7
class SearchOrdersApi extends AbstractApi
8
{
9
    /**
10
     * {@inheritdoc}
11
     */
12
    public function httpMethod(): HttpMethod
13
    {
14
        return HttpMethod::POST();
15
    }
16
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function path(): string
21
    {
22
        return 'orderList';
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function distillResponse(array $response): array
29
    {
30
        if(! isset($response['Search']['OrderInfo'])) {
31
            return [];
32
        }
33
34
//        dd(array_keys($response['Search']['OrderInfo']));
0 ignored issues
show
Unused Code Comprehensibility introduced by
80% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
35
        if(0 !== array_keys($response['Search']['OrderInfo'])[0]){
36
            return [$response['Search']['OrderInfo']];
37
        }
38
39
        return $response['Search']['OrderInfo'];
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function expectsFormFields(): bool
46
    {
47
        return false;
48
    }
49
}
50