Passed
Pull Request — master (#5)
by aguevaraIL
03:57
created

Credit   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 50
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A assignmentClass() 0 3 1
A slugBehaviorConfig() 0 4 1
A getLinks() 0 4 1
A extraFields() 0 5 1
A workLogClass() 0 3 1
1
<?php
2
3
namespace app\api\models;
4
5
use app\models as base;
6
use roaresearch\yii2\roa\hal\{Contract, ContractTrait};
7
8
/**
9
 * ROA contract to handle credit records.
10
 */
11
class Credit extends base\Credit implements Contract
12
{
13
    use ContractTrait {
14
        getLinks as getContractLinks;
15
    }
16
17
    /**
18
     * @inheritdoc
19
     */
20
    protected function assignmentClass(): string
21
    {
22
        return CreditAssignment::class;
23
    }
24
25
    /**
26
     * @inheritdoc
27
     */
28
    protected function workLogClass(): string
29
    {
30
        return CreditWorkLog::class;
31
    }
32
33
    /**
34
     * @inheritdoc
35
     */
36
    protected function slugBehaviorConfig(): array
37
    {
38
        return [
39
            'resourceName' => 'credit',
40
        ];
41
    }
42
43
    /**
44
     * @inheritdoc
45
     */
46
    public function getLinks()
47
    {
48
        return array_merge($this->getContractLinks(), [
49
            'worklog' => $this->getSelfLink() . '/worklog',
50
        ]);
51
    }
52
53
    /**
54
     * @inheritdoc
55
     */
56
    public function extraFields()
57
    {
58
        return [
59
            'workLogs',
60
            'activeWorkLog',
61
        ];
62
    }
63
}
64