InventoryChangedRequestEntity   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

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

2 Methods

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