FileModel::defineFieldDefinitions()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 37
Code Lines 31

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 31
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 37
rs 9.424
1
<?php
2
3
namespace Jidaikobo\Kontiki\Models;
4
5
class FileModel extends BaseModel
6
{
7
    use Traits\CRUDTrait;
8
9
    protected string $table = 'files';
10
11
    protected function defineFieldDefinitions(array $params = []): void
0 ignored issues
show
Unused Code introduced by
The parameter $params is not used and could be removed. ( Ignorable by Annotation )

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

11
    protected function defineFieldDefinitions(/** @scrutinizer ignore-unused */ array $params = []): void

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
12
    {
13
        $this->fieldDefinitions = [
14
            'id' => [
15
                'label' => 'ID',
16
            ],
17
            'path' => [
18
                'label' => __('path'),
19
                'type' => 'text',
20
                'attributes' => ['class' => 'form-control'],
21
                'label_attributes' => ['class' => 'form-label'],
22
                'default' => '',
23
                'searchable' => true,
24
                'rules' => ['required'],
25
                'filter' => FILTER_SANITIZE_FULL_SPECIAL_CHARS,
0 ignored issues
show
Bug introduced by
The constant Jidaikobo\Kontiki\Models...TIZE_FULL_SPECIAL_CHARS was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
26
                'template' => 'default',
27
                'group' => 'main',
28
                'fieldset_template' => 'forms/fieldset/flat.php',
29
            ],
30
            'description' => [
31
                'label' => __('description'),
32
                'description' => '',
33
                'type' => 'textarea',
34
                'attributes' => [
35
                  'class' => 'form-control',
36
                  'rows' => '2'
37
                ],
38
                'label_attributes' => ['class' => 'form-label'],
39
                'default' => '',
40
                'searchable' => true,
41
                'rules' => [
42
                    ['lengthMin', 3]
43
                ],
44
                'filter' => FILTER_UNSAFE_RAW,
45
                'template' => 'default',
46
                'group' => 'main',
47
                'fieldset_template' => 'forms/fieldset/flat.php',
48
            ],
49
        ];
50
    }
51
}
52