Passed
Push — master ( fb2db6...4a8108 )
by payever
02:07
created

InventoryCreateRequestEntity::setSku()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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 getStock()
25
 * @method string getExternalId()
26
 *
27
 * @method self setExternalId(string $externalId)
28
 */
29
class InventoryCreateRequestEntity extends RequestEntity
30
{
31
    const UNDERSCORE_ON_SERIALIZATION = false;
32
33
    /**
34
     * Subscription external id.
35
     * Required for all requests.
36
     *
37
     * @var string
38
     */
39
    protected $externalId;
40
41
    /**
42
     * Target product SKU
43
     *
44
     * @var string
45
     */
46
    protected $sku;
47
48
    /**
49
     * Initial qty of a product.
50
     * Only first request will actually create an inventory record on payever side.
51
     * All further create requests will be ignored.
52
     *
53
     * @var int
54
     */
55
    protected $stock;
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
     * @param int|float|string $stock
70
     * @return static
71
     */
72
    public function setStock($stock)
73
    {
74
        $this->stock = (int) $stock;
75
76
        return $this;
77
    }
78
79
    /**
80
     * @return array
81
     */
82
    public function getRequired()
83
    {
84
        return array(
85
            'externalId',
86
            'sku',
87
            'stock',
88
        );
89
    }
90
}
91