Completed
Pull Request — master (#23)
by
unknown
04:58
created

GenericApi::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 9
nc 1
nop 3
1
<?php
2
3
namespace Sylius\Api\Checkout\GenericApi;
4
5
use Sylius\Api\GenericApi as BaseApi;
6
7
class GenericApi extends BaseApi
8
{
9
    public function create(array $body, array $uriParameters = [], array $files = [])
10
    {
11
        $response = $this
0 ignored issues
show
Bug introduced by
The call to put() misses a required argument $body.

This check looks for function calls that miss required arguments.

Loading history...
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
            )
20
        ;
21
22
        return $response->getStatusCode() === 204;
23
    }
24
25
    public function update($id, array $body, array $uriParameters = [], array $files = [])
26
    {
27
        $uriParameters = array_merge(
28
            $uriParameters, ['cartId' => $id]
29
        );
30
31
        return $this->create(
32
            $body,
33
            $uriParameters,
34
            $files
35
        );
36
    }
37
}
38