ValidatesOptions::scaffoldRules()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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