forked from mallgroup/mpapi-client-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStats.php
93 lines (77 loc) · 1.98 KB
/
Stats.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php declare(strict_types=1);
namespace MpApiClient\Order\Entity;
use JsonSerializable;
use MpApiClient\Common\Util\JsonSerializeEntityTrait;
final class Stats implements JsonSerializable
{
use JsonSerializeEntityTrait;
private int $blocked;
private int $open;
private int $shipping;
private int $shipped;
private int $cancelled;
private int $delivered;
private int $lost;
private int $returned;
private function __construct(int $blocked, int $open, int $shipping, int $shipped, int $cancelled, int $delivered, int $lost, int $returned)
{
$this->blocked = $blocked;
$this->open = $open;
$this->shipping = $shipping;
$this->shipped = $shipped;
$this->cancelled = $cancelled;
$this->delivered = $delivered;
$this->lost = $lost;
$this->returned = $returned;
}
/**
* @param array<string, mixed> $data
*
* @internal
*/
public static function createFromApi(array $data): self
{
return new self(
(int) $data['blocked'],
(int) $data['open'],
(int) $data['shipping'],
(int) $data['shipped'],
(int) $data['cancelled'],
(int) $data['delivered'],
(int) $data['lost'],
(int) $data['returned'],
);
}
public function getBlocked(): int
{
return $this->blocked;
}
public function getOpen(): int
{
return $this->open;
}
public function getShipping(): int
{
return $this->shipping;
}
public function getShipped(): int
{
return $this->shipped;
}
public function getCancelled(): int
{
return $this->cancelled;
}
public function getDelivered(): int
{
return $this->delivered;
}
public function getLost(): int
{
return $this->lost;
}
public function getReturned(): int
{
return $this->returned;
}
}