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

RecordsTrait::getStatusProperty()   A

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
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
ccs 2
cts 2
cp 1
cc 1
nc 1
nop 1
crap 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