Passed
Branch develop (dc1a10)
by Jens
08:20
created

OrderUpdateByOrderNumberRequest::getOrderNumber()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 4
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * @author @jayS-de <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Request\Orders;
7
8
use Commercetools\Core\Model\Common\Context;
9
use Commercetools\Core\Request\AbstractUpdateRequest;
10
use Commercetools\Core\Model\Order\Order;
11
use Commercetools\Core\Response\ApiResponseInterface;
12
use Commercetools\Core\Model\MapperInterface;
13
14
/**
15
 * @package Commercetools\Core\Request\Orders
16
 * @link https://dev.commercetools.com/http-api-projects-orders.html#update-order-by-ordernumber
17
 * @method Order mapResponse(ApiResponseInterface $response)
18
 * @method Order mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null)
19
 */
20 View Code Duplication
class OrderUpdateByOrderNumberRequest extends AbstractUpdateRequest
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...
21
{
22
    protected $resultClass = Order::class;
23
24
    /**
25
     * @param string $orderNumber
26
     * @param string $version
27
     * @param array $actions
28
     * @param Context $context
29
     */
30 1
    public function __construct($orderNumber, $version, array $actions = [], Context $context = null)
31
    {
32 1
        parent::__construct(OrdersEndpoint::endpoint(), $orderNumber, $version, $actions, $context);
33 1
    }
34
35
    /**
36
     * @param string $orderNumber
37
     * @param int $version
38
     * @param Context $context
39
     * @return static
40
     */
41 1
    public static function ofOrderNumberAndVersion($orderNumber, $version, Context $context = null)
42
    {
43 1
        return new static($orderNumber, $version, [], $context);
44
    }
45
46
    /**
47
     * @return string
48
     */
49
    public function getOrderNumber()
50
    {
51
        return $this->getId();
52
    }
53
54
    /**
55
     * @param string $orderNumber
56
     * @return $this
57
     */
58
    public function setOrderNumber($orderNumber)
59
    {
60
        return $this->setId($orderNumber);
61
    }
62
63
    /**
64
     * @return string
65
     * @internal
66
     */
67 1
    protected function getPath()
68
    {
69 1
        return (string)$this->getEndpoint() . '/order-number=' . urlencode($this->getId()) . $this->getParamString();
70
    }
71
}
72