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

RecordTrait::setStatus()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
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\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