Total Complexity | 4 |
Total Lines | 63 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
4 | class FakeAdapter implements \Mezon\Gui\ListBuilder\ListBuilderAdapter |
||
5 | { |
||
6 | |||
7 | /** |
||
8 | * Records to be returned |
||
9 | * |
||
10 | * @var array |
||
11 | */ |
||
12 | protected $records = []; |
||
13 | |||
14 | /** |
||
15 | * Constructor |
||
16 | * |
||
17 | * @param array $records |
||
18 | */ |
||
19 | public function __construct(array $records = [ |
||
20 | [ |
||
21 | 'id' => 1, |
||
22 | ], |
||
23 | [ |
||
24 | 'id' => 2, |
||
25 | ] |
||
26 | ]) |
||
27 | { |
||
28 | $this->records = $records; |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * Method returns all vailable records |
||
33 | * |
||
34 | * @return array all vailable records |
||
35 | */ |
||
36 | public function all(): array |
||
37 | { |
||
38 | return $this->records; |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * Method returns a subset from vailable records |
||
43 | * |
||
44 | * @param array $order |
||
45 | * order settings |
||
46 | * @param int $from |
||
47 | * the beginning of the bunch |
||
48 | * @param int $limit |
||
49 | * the size of the batch |
||
50 | * @return array subset from vailable records |
||
51 | */ |
||
52 | public function getRecords(array $order, int $from, int $limit): array |
||
53 | { |
||
54 | return $this->all(); |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * Record preprocessor |
||
59 | * |
||
60 | * @param array $record |
||
61 | * record to be preprocessed |
||
62 | * @return array preprocessed record |
||
63 | */ |
||
64 | public function preprocessListItem(array $record): array |
||
67 | } |
||
68 | } |
||
69 |