Test Failed
Pull Request — master (#1)
by Carlos
04:03
created

SolicitudeValue::getLinks()   A

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;
7
use roaresearch\yii2\roa\hal\ContractTrait;
8
use yii\helpers\Url;
9
use yii\web\Link;
10
11
/**
12
 * ROA contract handling SolicitudeValue records.
13
 */
14
class SolicitudeValue extends base\SolicitudeValue implements Contract
15
{
16
    use ContractTrait {
17
        getLinks as getContractLinks;
18
    }
19
20
    /**
21
     * @inheritdoc
22
     */
23
    protected $sectionFieldClass = SectionField::class;
24
25
    /**
26
     * @inheritdoc
27
     */
28
    protected $sectionClass = Section::class;
29
30
    /**
31
     * @inheritdoc
32
     */
33
    protected $fieldClass = Field::class;
34
35
    /**
36
     * @inheritdoc
37
     */
38
    protected $solicitudeClass = Solicitude::class;
39
40
    /**
41
     * @inheritdoc
42
     */
43 5
    public function getLinks()
44
    {
45 5
        $selfLink = $this->getSelfLink();
0 ignored issues
show
Unused Code introduced by
The assignment to $selfLink is dead and can be removed.
Loading history...
46
47 5
        return array_merge($this->getContractLinks(), [
48 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

48
            'field' => $this->field->/** @scrutinizer ignore-call */ getSelfLink(),
Loading history...
49 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

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