Completed
Push — master ( 40c1d5...c7125f )
by Adam
02:42
created

AttributesTrait::__set()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Boduch\Grid;
4
5
use Symfony\Component\HttpFoundation\ParameterBag;
6
7
trait AttributesTrait
8
{
9
    /**
10
     * @var ParameterBag
11
     */
12
    public $attributes;
13
14
    /**
15
     * @return ParameterBag
16
     */
17
    public function attributes()
18
    {
19
        return $this->attributes;
20
    }
21
22
    /**
23
     * @param string $name
24
     * @param string $value
25
     */
26
    public function __set($name, $value)
27
    {
28
        $this->attributes[$name] = $value;
29
    }
30
31
    /**
32
     * @param $name
33
     * @return string|null
34
     */
35
    public function __get($name)
36
    {
37
        return $this->attributes[$name] ?? null;
38
    }
39
}
40