SectionField::extraFields()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace roaresearch\yii2\formgenerator\roa\models;
4
5
use roaresearch\yii2\formgenerator\models as base;
6
use roaresearch\yii2\roa\hal\{Contract, ContractTrait};
7
use yii\{helpers\Url, web\Link};
8
9
/**
10
 * ROA contract handling form SectionField records.
11
 */
12
class SectionField extends base\SectionField implements Contract
13
{
14
    use ContractTrait {
15
        getLinks as getContractLinks;
16
    }
17
18
    /**
19
     * @inheritdoc
20
     */
21
    protected $sectionClass = Section::class;
22
23
    /**
24
     * @inheritdoc
25
     */
26
    protected $fieldClass = Field::class;
27
28
    /**
29
     * @inheritdoc
30
     */
31
    protected $solicitudeValueClass = SolicitudeValue::class;
32
33
    /**
34
     * @inheritdoc
35
     */
36 4
    public function getLinks()
37
    {
38 4
        $selfLink = $this->getSelfLink();
0 ignored issues
show
Unused Code introduced by
The assignment to $selfLink is dead and can be removed.
Loading history...
39
40 4
        return array_merge($this->getContractLinks(), [
41 4
            'field' => $this->field->getSelfLink(),
0 ignored issues
show
Bug introduced by
The method getSelfLink() does not exist on roaresearch\yii2\formgenerator\models\Field. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

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

41
            'field' => $this->field->/** @scrutinizer ignore-call */ getSelfLink(),
Loading history...
42
        ]);
43
    }
44
45
    /**
46
     * @inheritdoc
47
     */
48 5
    protected function slugBehaviorConfig(): array
49
    {
50
        return [
51 5
            'idAttribute' => 'field_id',
52
            'resourceName' => 'field',
53
            'parentSlugRelation' => 'section',
54
        ];
55
    }
56
57
    /**
58
     * @inheritdoc
59
     */
60 4
    public function extraFields()
61
    {
62 4
        return ['field', 'section', 'solicitudeValuesDetail'];
63
    }
64
}
65