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

GetItemStockInfoApi::distillResponse()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
1
<?php
2
3
namespace Shippinno\YahooShoppingJp\Api;
4
5
use Shippinno\YahooShoppingJp\Exception\DistillationException;
6
use Shippinno\YahooShoppingJp\HttpMethod;
7
8
class GetItemStockInfoApi 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 'getStock';
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function distillResponse(array $response): array
30
    {
31
        if(! isset($response['Result'])) {
32
            throw new DistillationException;
33
        }
34
35
        return $response['Result'];
36
    }
37
}
38