Total Complexity | 7 |
Total Lines | 45 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | trait TFill |
||
16 | { |
||
17 | use TNullBytes; |
||
18 | |||
19 | /** |
||
20 | * @param string $source |
||
21 | * @param array<int|string, mixed|null> $entries |
||
22 | * @return Interfaces\IEntry[] |
||
23 | */ |
||
24 | 10 | protected function fillFromEntries(string $source, array $entries): array |
|
25 | { |
||
26 | 10 | $result = []; |
|
27 | 10 | foreach ($entries as $key => $value) { |
|
28 | 10 | $result[] = $this->fillEntryData($source, $this->removeNullBytes(strval($key)), $value); |
|
29 | } |
||
30 | 10 | return $result; |
|
31 | } |
||
32 | |||
33 | /** |
||
34 | * @param string $source |
||
35 | * @param iterable<int|string, mixed|null> $iterator |
||
36 | * @return Interfaces\IEntry[] |
||
37 | */ |
||
38 | 2 | protected function fillFromIterator(string $source, iterable $iterator): array |
|
39 | { |
||
40 | 2 | $result = []; |
|
41 | 2 | foreach ($iterator as $key => $value) { |
|
42 | 2 | $result[] = $this->fillEntryData($source, $this->removeNullBytes(strval($key)), $value); |
|
43 | } |
||
44 | 2 | return $result; |
|
45 | } |
||
46 | |||
47 | /** |
||
48 | * @param string $source |
||
49 | * @param string $key |
||
50 | * @param mixed|null $value |
||
51 | * @return Entry |
||
52 | */ |
||
53 | 12 | protected function fillEntryData(string $source, string $key, $value): Entry |
|
60 | } |
||
61 | } |
||
62 |