Total Complexity | 12 |
Total Lines | 117 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
7 | abstract class AbstractList extends AbstractPart implements Iterator |
||
8 | { |
||
9 | /** |
||
10 | * @var array $list List of item into the list |
||
11 | */ |
||
12 | protected $list = []; |
||
13 | |||
14 | /** |
||
15 | * @var integer $position Iterator cursor position |
||
16 | */ |
||
17 | protected $position = 0; |
||
18 | |||
19 | /** |
||
20 | * @var string $separator The separator to use between items during |
||
21 | * the call to generate() |
||
22 | */ |
||
23 | protected $separator = ''; |
||
24 | |||
25 | /** |
||
26 | * Getter accessor to property list |
||
27 | * |
||
28 | * @return array |
||
29 | */ |
||
30 | public function getList(): array |
||
31 | { |
||
32 | return $this->list; |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * Getter accessor to property position |
||
37 | * |
||
38 | * @return integer |
||
39 | */ |
||
40 | public function getPosition(): int |
||
41 | { |
||
42 | return $this->position; |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * Getter accessor to property separator |
||
47 | * |
||
48 | * @return string |
||
49 | */ |
||
50 | public function getSeparator(): string |
||
51 | { |
||
52 | return $this->separator; |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * Setter accessor to property partPrefix |
||
57 | * |
||
58 | * @param string $prefix |
||
59 | * |
||
60 | * @return $this |
||
61 | */ |
||
62 | public function setPartPrefix(string $prefix): self |
||
63 | { |
||
64 | $this->partPrefix = $prefix; |
||
65 | return $this; |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * {@inheritdoc} |
||
70 | */ |
||
71 | public function current() |
||
72 | { |
||
73 | return $this->list[$this->position]; |
||
74 | } |
||
75 | |||
76 | /** |
||
77 | * {@inheritdoc} |
||
78 | */ |
||
79 | public function key(): int |
||
82 | } |
||
83 | |||
84 | /** |
||
85 | * {@inheritdoc} |
||
86 | */ |
||
87 | public function next() |
||
88 | { |
||
89 | ++$this->position; |
||
90 | } |
||
91 | |||
92 | /** |
||
93 | * {@inheritdoc} |
||
94 | */ |
||
95 | public function rewind() |
||
96 | { |
||
97 | $this->position = 0; |
||
98 | } |
||
99 | |||
100 | /** |
||
101 | * {@inheritdoc} |
||
102 | */ |
||
103 | public function valid(): bool |
||
106 | } |
||
107 | |||
108 | /** |
||
109 | * {@inheritdoc} |
||
110 | */ |
||
111 | public function generate(): string |
||
124 | } |
||
125 | } |
||
126 |