BlendableProperties::setProperties()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: joshgulledge
5
 * Date: 3/5/18
6
 * Time: 11:51 AM
7
 */
8
9
namespace LCI\Blend\Blendable;
10
11
use LCI\Blend\Properties;
12
13
trait BlendableProperties
14
{
15
    /** @var null|Properties  */
16
    protected $properties = null;
17
18
    protected function loadProperties()
19
    {
20
        $this->properties = new Properties();
21
    }
22
23
    /**
24
     * @return Properties
25
     */
26
    public function getProperties()
27
    {
28
        return $this->properties;
29
    }
30
31
    /**
32
     * @return array
33
     */
34
    public function getPropertiesData()
35
    {
36
        return $this->properties->getData();
0 ignored issues
show
Bug introduced by
The method getData() does not exist on null. ( Ignorable by Annotation )

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

36
        return $this->properties->/** @scrutinizer ignore-call */ getData();

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...
37
    }
38
39
    /**
40
     * @param $name
41
     * @param $value
42
     * @return $this
43
     */
44
    public function setProperty($name, $value)
45
    {
46
        $this->properties->setProperty($name, $value);
47
        return $this;
48
    }
49
    /**
50
     * @param array $data
51
     *
52
     * @return $this
53
     */
54
    public function setProperties(array $data)
55
    {
56
        $this->properties->mergePropertiesFromArray($data);
57
        return $this;
58
    }
59
60
}