Entry   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 18
ccs 8
cts 8
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A loadVars() 0 10 2
1
<?php
2
3
namespace kalanis\kw_input\Loaders;
4
5
6
use kalanis\kw_input\Entries;
7
8
9
/**
10
 * Class Entry
11
 * @package kalanis\kw_input\Loaders
12
 * Load input arrays into normalized entries
13
 */
14
class Entry extends ALoader
15
{
16
    /**
17
     * Transform input values to something more reliable
18
     * @param string $source
19
     * @param array<string|int, string|int|bool|string[]|int[]> $array
20
     * @return Entries\Entry[]
21
     */
22 4
    public function loadVars(string $source, $array): array
23
    {
24 4
        $result = [];
25 4
        $entries = new Entries\Entry();
26 4
        foreach ($array as $postedKey => $posted) {
27 4
            $entry = clone $entries;
28 4
            $entry->setEntry($source, strval($postedKey), $posted);
29 4
            $result[] = $entry;
30
        }
31 4
        return $result;
32
    }
33
}
34