Passed
Push — master ( 845f48...10361c )
by Gabriel
05:36
created

RecordTrait   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 55.56%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 42
ccs 5
cts 9
cp 0.5556
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getStatus() 0 4 1
A setStatus() 0 5 1
A getNewStatus() 0 5 1
A updateStatus() 0 5 1
1
<?php
2
3
namespace ByTIC\Models\SmartProperties\RecordsTraits\HasStatus;
4
5
use ByTIC\Models\SmartProperties\Properties\AbstractProperty\Generic;
6
use ByTIC\Models\SmartProperties\RecordsTraits\HasSmartProperties\RecordTrait as HasSmartPropertiesRecord;
7
use Nip\Records\RecordManager;
8
9
/**
10
 * Class RecordTrait
11
 * @package ByTIC\Models\SmartProperties\RecordsTraits\HasStatus
12
 *
13
 * @property string $status
14
 * @method RecordManager|RecordsTrait getManager()
15
 *
16
 */
17
trait RecordTrait
18
{
19
    use \ByTIC\Models\SmartProperties\RecordsTraits\AbstractTrait\RecordTrait;
20
    use HasSmartPropertiesRecord;
21
22
    /**
23
     * @return Generic
24
     */
25 2
    public function getStatus()
26
    {
27 2
        return $this->getSmartProperty('Status');
28
    }
29
30
    /**
31
     * @param $value
32
     */
33 1
    public function setStatus($value)
34
    {
35
        /** @noinspection PhpUnhandledExceptionInspection */
36 1
        $this->setSmartProperty('Status', $value);
37 1
    }
38
39
    /**
40
     * @param $status
41
     * @return Generic
42
     */
43
    public function getNewStatus($status)
44
    {
45
        /** @noinspection PhpUnhandledExceptionInspection */
46
        return $this->getNewSmartPropertyFromValue('Status', $status);
47
    }
48
49
    /**
50
     * @param bool $status
51
     * @return bool|void
52
     */
53
    public function updateStatus($status = false)
54
    {
55
        /** @noinspection PhpUnhandledExceptionInspection */
56
        return $this->updateSmartProperty('Status', $status);
57
    }
58
}
59