Completed
Pull Request — master (#24)
by
unknown
02:00
created

GenericApi::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 10

Duplication

Lines 16
Ratio 100 %

Importance

Changes 0
Metric Value
dl 16
loc 16
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 10
nc 1
nop 3
1
<?php
2
3
namespace Sylius\Api\Checkout;
4
5
use Sylius\Api\GenericApi as BaseApi;
6
7
class GenericApi extends BaseApi
8
{
9 View Code Duplication
    public function create(array $body, array $uriParameters = [], array $files = [])
0 ignored issues
show
Duplication introduced by
This method 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
        $response = $this
12
            ->getClient()
13
            ->put(
14
                $this->getUri(
15
                    $uriParameters,
16
                    $body,
0 ignored issues
show
Unused Code introduced by
The call to GenericApi::getUri() has too many arguments starting with $body.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
17
                    $files
18
                ),
19
                $body
20
            )
21
        ;
22
23
        return $response->getStatusCode() === 204;
24
    }
25
26 View Code Duplication
    public function update($id, array $body, array $uriParameters = [], array $files = [])
0 ignored issues
show
Duplication introduced by
This method 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...
27
    {
28
        $uri = sprintf('%s%s', $this->getUri($uriParameters), $id);
29
30
        $response = $this
31
            ->getClient()
32
            ->put(
33
                $uri,
34
                $body
35
            )
36
        ;
37
38
        return $response->getStatusCode() === 204;
39
    }
40
}
41