Test Failed
Pull Request — master (#19)
by Aya
03:26
created

UpdateOrderShippingStatusApi   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 39
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 3
dl 39
loc 39
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A httpMethod() 4 4 1
A path() 4 4 1
A distillResponse() 9 9 3
A expectsFormFields() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Shippinno\YahooShoppingJp\Api;
4
5
use Shippinno\YahooShoppingJp\Exception\DistillationException;
6
use Shippinno\YahooShoppingJp\HttpMethod;
7
8 View Code Duplication
class UpdateOrderShippingStatusApi 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...
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
}