ItemWasAddedToShoppingBasket::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 2
1
<?php declare(strict_types=1);
2
namespace Kepawni\Twilted\Basic\TestSample\Event;
3
4
use Kepawni\Twilted\Basic\EqualsUsesWindUp;
5
use Kepawni\Twilted\EventPayload;
6
use Kepawni\Twilted\Windable;
7
8
class ItemWasAddedToShoppingBasket implements EventPayload
9
{
10
    use EqualsUsesWindUp;
11
    private $itemCode;
12
    private $quantity;
13
14
    public function __construct(string $itemCode, int $quantity)
15
    {
16
        $this->itemCode = $itemCode;
17
        $this->quantity = $quantity;
18
    }
19
20
    public static function unwind(array $spool): Windable
21
    {
22
        return new static($spool[0], $spool[1]);
23
    }
24
25
    public function getItemCode(): string
26
    {
27
        return $this->itemCode;
28
    }
29
30
    public function getQuantity(): int
31
    {
32
        return $this->quantity;
33
    }
34
35
    public function windUp(): array
36
    {
37
        return [$this->itemCode, $this->quantity];
38
    }
39
}
40