HasPlaces   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 7
c 0
b 0
f 0
dl 0
loc 33
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A addPlace() 0 3 1
A getPlaces() 0 4 1
A getItemsNames() 0 3 1
A setPlaces() 0 3 1
1
<?php
2
3
namespace ByTIC\Models\SmartProperties\Definitions\Definition;
4
5
/**
6
 * Trait HasPlaces
7
 * @package ByTIC\Models\SmartProperties\Definitions\Traits
8
 */
9
trait HasPlaces
10
{
11
    protected $places = [];
12
13
    /**
14
     * @return array
15
     */
16
    public function getPlaces(): array
17
    {
18
        $this->checkBuild();
0 ignored issues
show
Bug introduced by
It seems like checkBuild() 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

18
        $this->/** @scrutinizer ignore-call */ 
19
               checkBuild();
Loading history...
19
        return $this->places;
20
    }
21
22
    /**
23
     * @param array $places
24
     */
25
    public function setPlaces(array $places): void
26
    {
27
        $this->places = $places;
28
    }
29
30
    public function addPlace()
31
    {
32
        $this->places = array_unique(array_merge($this->places, func_get_args()));
33
    }
34
35
    /**
36
     * @return array
37
     * @deprecated use getPlaces
38
     */
39
    public function getItemsNames()
40
    {
41
        return $this->getPlaces();
42
    }
43
}
44