Passed
Push — master ( bcadde...416dc9 )
by Gabriel
02:50 queued 12s
created

RecordsTrait   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 7
c 0
b 0
f 0
dl 0
loc 35
rs 10
ccs 8
cts 8
cp 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getStatusProperty() 0 3 1
A getStatuses() 0 3 1
A registerSmartProperties() 0 3 1
A getStatus() 0 3 1
1
<?php
2
3
namespace ByTIC\Models\SmartProperties\RecordsTraits\HasStatus;
4
5
use ByTIC\Models\SmartProperties\Properties\Statuses\Generic as GenericStatus;
6
use Exception;
7
8
/**
9
 * Class RecordsTrait
10
 * @package ByTIC\Models\SmartProperties\RecordsTraits\HasStatus
11
 */
12
trait RecordsTrait
13
{
14
    use \ByTIC\Models\SmartProperties\RecordsTraits\AbstractTrait\RecordsTrait;
15
    use \ByTIC\Models\SmartProperties\RecordsTraits\HasSmartProperties\RecordsTrait;
16
17
    /**
18
     * @param $name
19
     * @return array
20
     */
21 1
    public function getStatusProperty($name)
22
    {
23 1
        return $this->getSmartPropertyValues('Status', $name);
24
    }
25
26
    /**
27
     * @return null|GenericStatus[]
28
     */
29 1
    public function getStatuses()
30
    {
31 1
        return $this->getSmartPropertyItems('Status');
32
    }
33
34
    /**
35
     * @param string $name
36
     * @return GenericStatus
37
     * @throws Exception
38
     */
39 1
    public function getStatus($name = null)
40
    {
41 1
        return $this->getSmartPropertyItem('Status', $name);
42
    }
43
44 6
    protected function registerSmartProperties()
45
    {
46 6
        $this->registerSmartProperty('status');
47 6
    }
48
}
49