HasOptions   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A scaffoldForm() 0 13 2
A form() 0 3 1
1
<?php
2
3
namespace Terranet\Administrator\Traits\Module;
4
5
use Terranet\Administrator\Field\Text;
6
use Terranet\Administrator\Form\Collection\Mutable;
7
use Terranet\Administrator\Form\FormElement;
0 ignored issues
show
Bug introduced by
The type Terranet\Administrator\Form\FormElement was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
9
trait HasOptions
10
{
11
    /**
12
     * List of editable options.
13
     *
14
     * @return Mutable
15
     */
16
    public function form()
17
    {
18
        return $this->scaffoldForm();
19
    }
20
21
    /**
22
     * @return Mutable
23
     */
24
    protected function scaffoldForm()
25
    {
26
        $collection = new Mutable();
27
28
        foreach (options_fetch() as $option) {
0 ignored issues
show
Bug introduced by
The function options_fetch was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

28
        foreach (/** @scrutinizer ignore-call */ options_fetch() as $option) {
Loading history...
29
            $element = Text::make($option->key)->setValue($option->value);
30
31
            $collection->push(
32
                $element
33
            );
34
        }
35
36
        return $collection;
37
    }
38
}
39