Code Duplication    Length = 38-39 lines in 2 locations

src/YahooShoppingJp/Api/UpdateItemStockInfoApi.php 1 location

@@ 9-46 (lines=38) @@
6
use Shippinno\YahooShoppingJp\HttpMethod;
7
use YConnect\Exception\ApiException;
8
9
class UpdateItemStockInfoApi extends AbstractApi
10
{
11
    /**
12
     * {@inheritdoc}
13
     */
14
    public function httpMethod(): HttpMethod
15
    {
16
        return HttpMethod::POST();
17
    }
18
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function path(): string
23
    {
24
        return 'setStock';
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function distillResponse(array $response): array
31
    {
32
        if (! isset($response['@attributes']['totalResultsAvailable'])) {
33
            throw new ApiException('予期しないエラー');
34
        }
35
36
        return isset($response['Result']) ? $response['Result'] : [];
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function expectsFormFields(): bool
43
    {
44
        return true;
45
    }
46
}
47

src/YahooShoppingJp/Api/UpdateOrderShippingStatusApi.php 1 location

@@ 8-46 (lines=39) @@
5
use Shippinno\YahooShoppingJp\Exception\DistillationException;
6
use Shippinno\YahooShoppingJp\HttpMethod;
7
8
class UpdateOrderShippingStatusApi 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 'orderShipStatusChange';
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function distillResponse(array $response): array
30
    {
31
        if(! isset($response['Result']['Status'])
32
        || $response['Result']['Status'] !== 'OK') {
33
            throw new DistillationException;
34
        }
35
36
        return array();
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function expectsFormFields(): bool
43
    {
44
        return false;
45
    }
46
}