Completed
Push — master ( 2b7ec8...e65692 )
by Alex
09:34
created

FakeAdapter::preprocessListItem()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
namespace Mezon\Gui\Field\Tests;
3
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
65
    {
66
        return $record;
67
    }
68
}
69