Passed
Push — master ( 0e85a7...3ec6ca )
by Gabriel
02:46
created

PropertyRecordsTrait::getStatusProperty()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 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
 * Trait PropertyRecordsTrait
10
 * @package ByTIC\Models\SmartProperties\RecordsTraits\HasStatus
11
 */
12
trait PropertyRecordsTrait
13
{
14
    /**
15
     * @param $name
16
     * @return array
17
     */
18
    public function getStatusProperty($name): array
19
    {
20
        return $this->getSmartPropertyValues('Status', $name);
0 ignored issues
show
Bug introduced by
It seems like getSmartPropertyValues() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
        return $this->/** @scrutinizer ignore-call */ getSmartPropertyValues('Status', $name);
Loading history...
21
    }
22
23
    /**
24
     * @return null|GenericStatus[]
25
     */
26
    public function getStatuses(): ?array
27
    {
28
        return $this->getSmartPropertyItems('Status');
0 ignored issues
show
Bug introduced by
It seems like getSmartPropertyItems() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

28
        return $this->/** @scrutinizer ignore-call */ getSmartPropertyItems('Status');
Loading history...
29
    }
30
31
    /**
32
     * @param string $name
33
     * @return GenericStatus
34
     * @throws Exception
35
     */
36
    public function getStatus($name = null): GenericStatus
37
    {
38
        return $this->getSmartPropertyItem('Status', $name);
0 ignored issues
show
Bug introduced by
It seems like getSmartPropertyItem() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

38
        return $this->/** @scrutinizer ignore-call */ getSmartPropertyItem('Status', $name);
Loading history...
39
    }
40
41
    protected function registerSmartPropertyStatus()
42
    {
43
        $this->registerSmartProperty('status');
0 ignored issues
show
Bug introduced by
The method registerSmartProperty() does not exist on ByTIC\Models\SmartProper...us\PropertyRecordsTrait. Did you maybe mean registerSmartPropertyStatus()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

43
        $this->/** @scrutinizer ignore-call */ 
44
               registerSmartProperty('status');

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
44
    }
45
}