Passed
Push — master ( 617266...2422af )
by Siim
10:33
created

AbstractDto::__get()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: siim
5
 * Date: 24.01.19
6
 * Time: 16:01
7
 */
8
9
namespace Sf4\Api\Dto;
10
11
use Sf4\Api\Utils\Traits\SerializerTrait;
12
13
abstract class AbstractDto implements DtoInterface
14
{
15
    use SerializerTrait;
16
17
    /**
18
     * @param $name
19
     * @param $value
20
     */
21
    public function __set($name, $value)
22
    {
23
        if (property_exists($this, $name)) {
24
            $this->$name = $value;
25
        }
26
    }
27
28
    /**
29
     * @param $name
30
     * @return mixed|null
31
     */
32
    public function __get($name)
33
    {
34
        if (property_exists($this, $name)) {
35
            return $this->$name;
36
        }
37
38
        return null;
39
    }
40
}
41