-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathBasicOrderList.php
More file actions
48 lines (40 loc) · 950 Bytes
/
BasicOrderList.php
File metadata and controls
48 lines (40 loc) · 950 Bytes
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
<?php declare(strict_types=1);
namespace MpApiClient\Order\Entity;
use Closure;
use Exception;
use MpApiClient\Common\Util\AbstractList;
use MpApiClient\Filter\Filter;
/**
* @extends AbstractList<BasicOrder>
* @property BasicOrder[] $data
*/
final class BasicOrderList extends AbstractList
{
/**
* @throws Exception
*/
public static function createWithCallback(Closure $callback, Filter $filter): self
{
return new self($callback, $filter);
}
/**
* @return false|BasicOrder
*/
public function current()
{
return current($this->data);
}
/**
* @param array<int, array<string, mixed>> $data
* @return BasicOrder[]
* @throws Exception
*/
protected function parseData(array $data): array
{
$items = [];
foreach ($data as $item) {
$items[] = BasicOrder::createFromApi($item);
}
return $items;
}
}