InputFilesAdapter::current()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

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