SolicitudeValue::getLinks()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 7
ccs 5
cts 5
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 SolicitudeValue records.
11
 */
12
class SolicitudeValue extends base\SolicitudeValue implements Contract
13
{
14
    use ContractTrait {
15
        getLinks as getContractLinks;
16
    }
17
18
    /**
19
     * @inheritdoc
20
     */
21
    protected $sectionFieldClass = SectionField::class;
22
23
    /**
24
     * @inheritdoc
25
     */
26
    protected $sectionClass = Section::class;
27
28
    /**
29
     * @inheritdoc
30
     */
31
    protected $fieldClass = Field::class;
32
33
    /**
34
     * @inheritdoc
35
     */
36
    protected $solicitudeClass = Solicitude::class;
37
38
    /**
39
     * @inheritdoc
40
     */
41 5
    public function getLinks()
42
    {
43 5
        $selfLink = $this->getSelfLink();
0 ignored issues
show
Unused Code introduced by
The assignment to $selfLink is dead and can be removed.
Loading history...
44
45 5
        return array_merge($this->getContractLinks(), [
46 5
            '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

46
            'field' => $this->field->/** @scrutinizer ignore-call */ getSelfLink(),
Loading history...
47 5
            'section' => $this->section->getSelfLink(),
0 ignored issues
show
Bug introduced by
The method getSelfLink() does not exist on roaresearch\yii2\formgenerator\models\Section. 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

47
            'section' => $this->section->/** @scrutinizer ignore-call */ getSelfLink(),
Loading history...
48
        ]);
49
    }
50
51
    /**
52
     * @inheritdoc
53
     */
54 6
    protected function slugBehaviorConfig(): array
55
    {
56
        return [
57 6
            'idAttribute' => ['section_id', 'field_id'],
58
            'resourceName' => 'value',
59
            'parentSlugRelation' => 'solicitude',
60
        ];
61
    }
62
63
    /**
64
     * @inheritdoc
65
     */
66 5
    public function extraFields()
67
    {
68
        return [
69 5
            'field',
70
            'section',
71
            'sectionField',
72
            'solicitude',
73
        ];
74
    }
75
}
76