Test Failed
Pull Request — develop (#32)
by Yuji
11:42
created

UpdateItemStockInfoApi::path()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Shippinno\YahooShoppingJp\Api;
4
5
use Shippinno\YahooShoppingJp\Factory\UpdateItemStockFactory;
6
use Shippinno\YahooShoppingJp\HttpMethod;
7
use YConnect\Exception\ApiException;
8
9 View Code Duplication
class UpdateItemStockInfoApi extends AbstractApi
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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