InputFilesAdapter::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
ccs 2
cts 2
cp 1
crap 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