InputFilesAdapter   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A current() 0 7 2
A __construct() 0 3 1
A loadEntries() 0 3 1
1
<?php
2
3
namespace kalanis\kw_forms\Adapters;
4
5
6
use kalanis\kw_forms\Exceptions\FormsException;
7
use kalanis\kw_input\Interfaces\IEntry;
8
use kalanis\kw_input\Interfaces\IFiltered;
9
10
11
/**
12
 * Class InputFilesAdapter
13
 * @package kalanis\kw_forms\Adapters
14
 */
15
class InputFilesAdapter extends FilesAdapter
16
{
17
    protected IFiltered $inputs;
18
19 1
    public function __construct(IFiltered $inputs)
20
    {
21 1
        $this->inputs = $inputs;
22 1
    }
23
24 1
    public function loadEntries(string $inputType): void
25
    {
26 1
        $this->vars = $this->inputs->getInArray(null, [IEntry::SOURCE_FILES]);
27 1
    }
28
29
    #[\ReturnTypeWillChange]
30 1
    public function current()
31
    {
32 1
        if ($this->valid()) {
33 1
            return $this->offsetGet($this->key);
34
        }
35 1
        throw new FormsException(sprintf('Unknown offset %s', $this->key));
36
    }
37
}
38