PropertyRecordsTrait   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 5
dl 0
loc 37
rs 10
c 1
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getType() 0 3 1
A getTypeProperty() 0 3 1
A registerSmartPropertyType() 0 3 1
A getTypes() 0 3 1
1
<?php
2
3
namespace ByTIC\Models\SmartProperties\RecordsTraits\HasTypes;
4
5
use ByTIC\Models\SmartProperties\Properties\Statuses\Generic as GenericStatus;
6
use ByTIC\Models\SmartProperties\Properties\Types\Generic as GenericType;
7
8
/**
9
 * Trait PropertyRecordsTrait
10
 * @package ByTIC\Models\SmartProperties\RecordsTraits\HasTypes
11
 */
12
trait PropertyRecordsTrait
13
{
14
    /**
15
     * Get property of a type by name
16
     *
17
     * @param string $name Type name
18
     *
19
     * @return array
20
     */
21
    public function getTypeProperty($name)
22
    {
23
        return $this->getSmartPropertyValues('Type', $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

23
        return $this->/** @scrutinizer ignore-call */ getSmartPropertyValues('Type', $name);
Loading history...
24
    }
25
26
    /**
27
     * Get all the types array
28
     *
29
     * @return GenericType[]|null
30
     */
31
    public function getTypes()
32
    {
33
        return $this->getSmartPropertyItems('Type');
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

33
        return $this->/** @scrutinizer ignore-call */ getSmartPropertyItems('Type');
Loading history...
34
    }
35
36
    /**
37
     * @param string $name
38
     * @return GenericStatus
39
     * @throws Exception
40
     */
41
    public function getType($name = null)
42
    {
43
        return $this->getSmartPropertyItem('Type', $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

43
        return $this->/** @scrutinizer ignore-call */ getSmartPropertyItem('Type', $name);
Loading history...
44
    }
45
46
    protected function registerSmartPropertyType()
47
    {
48
        $this->registerSmartProperty('type');
0 ignored issues
show
Bug introduced by
The method registerSmartProperty() does not exist on ByTIC\Models\SmartProper...es\PropertyRecordsTrait. Did you maybe mean registerSmartPropertyType()? ( Ignorable by Annotation )

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

48
        $this->/** @scrutinizer ignore-call */ 
49
               registerSmartProperty('type');

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...
49
    }
50
}
51