ValidatesOptions   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A rules() 0 3 1
A scaffoldRules() 0 4 1
1
<?php
2
3
namespace Terranet\Administrator\Traits\Module;
4
5
trait ValidatesOptions
6
{
7
    /**
8
     * Define validation rules.
9
     */
10
    public function rules()
11
    {
12
        return $this->scaffoldRules();
13
    }
14
15
    /**
16
     * Build a list of supposed validators based on columns and indexes information.
17
     *
18
     * @return array
19
     */
20
    protected function scaffoldRules()
21
    {
22
        return array_build(options_fetch(), function ($key, $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

22
        return array_build(/** @scrutinizer ignore-call */ options_fetch(), function ($key, $option) {
Loading history...
23
            return [$option->key, 'required'];
24
        });
25
    }
26
}
27