Passed
Branch master (776013)
by payever
03:51
created

InventoryChangedRequestEntity   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 11
dl 0
loc 47
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getRequired() 0 6 1
A setSku() 0 5 1
1
<?php
2
/**
3
 * PHP version 5.4 and 7
4
 *
5
 * @package   Payever\Inventory
6
 * @author    Hennadii.Shymanskyi <[email protected]>
7
 * @copyright 2017-2019 payever GmbH
8
 * @license   MIT <https://opensource.org/licenses/MIT>
9
 */
10
11
namespace Payever\ExternalIntegration\Inventory\Http\RequestEntity;
12
13
use Payever\ExternalIntegration\Core\Http\RequestEntity;
14
15
/**
16
 * PHP version 5.4 and 7
17
 *
18
 * @package   Payever\Inventory
19
 * @author    Hennadii.Shymanskyi <[email protected]>
20
 * @copyright 2017-2019 payever GmbH
21
 * @license   MIT <https://opensource.org/licenses/MIT>
22
 *
23
 * @method string getSku()
24
 * @method int getQuantity()
25
 * @method string getExternalId()
26
 *
27
 * @method self setQuantity(int $quantity)
28
 * @method self setExternalId(string $externalId)
29
 */
30
class InventoryChangedRequestEntity extends RequestEntity
31
{
32
    const UNDERSCORE_ON_SERIALIZATION = false;
33
34
    /**
35
     * Subscription external id.
36
     * Required for all requests.
37
     *
38
     * @var string
39
     */
40
    protected $externalId;
41
42
    /**
43
     * Target product SKU
44
     *
45
     * @var string
46
     */
47
    protected $sku;
48
49
    /**
50
     * Unsigned diff between previous and current states.
51
     * Addition or subtraction is indicated by endpoint this entity sent to.
52
     *
53
     * @var int
54
     */
55
    protected $quantity;
56
57
    /**
58
     * @param string $sku
59
     * @return static
60
     */
61
    public function setSku($sku)
62
    {
63
        $this->sku = (string) $sku;
64
65
        return $this;
66
    }
67
68
    /**
69
     * @return array
70
     */
71
    public function getRequired()
72
    {
73
        return array(
74
            'externalId',
75
            'sku',
76
            'quantity',
77
        );
78
    }
79
}
80