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

InventoryCreateRequestEntity::getRequired()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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 setStock(int $quantity)
28
 * @method self setExternalId(string $externalId)
29
 */
30
class InventoryCreateRequestEntity 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
     * Initial qty of a product.
51
     * Only first request will actually create an inventory record on payever side.
52
     * All further create requests will be ignored.
53
     *
54
     * @var int
55
     */
56
    protected $stock;
57
58
    /**
59
     * @param string $sku
60
     * @return static
61
     */
62
    public function setSku($sku)
63
    {
64
        $this->sku = (string) $sku;
65
66
        return $this;
67
    }
68
69
    /**
70
     * @return array
71
     */
72
    public function getRequired()
73
    {
74
        return array(
75
            'externalId',
76
            'sku',
77
            'stock',
78
        );
79
    }
80
}
81