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

GetOrderInfoApi   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 3
dl 0
loc 38
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A httpMethod() 0 4 1
A path() 0 4 1
A distillResponse() 0 8 2
A expectsFormFields() 0 4 1
1
<?php
2
3
namespace Shippinno\YahooShoppingJp\Api;
4
5
use Shippinno\YahooShoppingJp\Exception\DistillationException;
6
use Shippinno\YahooShoppingJp\HttpMethod;
7
8
class GetOrderInfoApi extends AbstractApi
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function httpMethod(): HttpMethod
14
    {
15
        return HttpMethod::POST();
16
    }
17
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public function path(): string
22
    {
23
        return 'orderInfo';
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function distillResponse(array $response): array
30
    {
31
        if(! isset($response['Result']['OrderInfo'])) {
32
            throw new DistillationException;
33
        }
34
35
        return $response['Result']['OrderInfo'];
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public function expectsFormFields(): bool
42
    {
43
        return false;
44
    }
45
}
46