Passed
Branch php-scrutinizer (9ddcba)
by Jens
09:45
created

MeCartUpdateRequest::ofIdAndVersion()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 3
crap 2
1
<?php
2
/**
3
 * @author @jenschude <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Request\Me;
7
8
use Commercetools\Core\Model\Cart\Cart;
9
use Commercetools\Core\Model\Common\Context;
10
use Commercetools\Core\Request\AbstractUpdateRequest;
11
use Commercetools\Core\Response\ApiResponseInterface;
12
use Commercetools\Core\Model\MapperInterface;
13
14
/**
15
 * @package Commercetools\Core\Request\Me
16
 * @link https://docs.commercetools.com/http-api-projects-me-carts.html#update-cart
17
 * @method Cart mapResponse(ApiResponseInterface $response)
18
 * @method Cart mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null)
19
 */
20
class MeCartUpdateRequest extends AbstractUpdateRequest
21
{
22
    protected $resultClass = Cart::class;
23
24
    /**
25
     * @param string $id
26
     * @param string $version
27
     * @param array $actions
28
     * @param Context $context
29
     */
30
    public function __construct($id, $version, array $actions = [], Context $context = null)
31
    {
32
        parent::__construct(MeCartsEndpoint::endpoint(), $id, $version, $actions, $context);
0 ignored issues
show
Bug introduced by
$version of type string is incompatible with the type integer expected by parameter $version of Commercetools\Core\Reque...eRequest::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

32
        parent::__construct(MeCartsEndpoint::endpoint(), $id, /** @scrutinizer ignore-type */ $version, $actions, $context);
Loading history...
33
    }
34
35
    /**
36
     * @param string $id
37
     * @param int $version
38
     * @param Context $context
39
     * @return static
40
     */
41
    public static function ofIdAndVersion($id, $version, Context $context = null)
42
    {
43
        return new static($id, $version, [], $context);
44
    }
45
}
46