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

AbstractDto   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __set() 0 4 2
A __get() 0 7 2
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