Passed
Push — master ( eff73f...ae14df )
by Siim
14:39
created

AbstractDto::__isset()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
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 bool
31
     */
32
    public function __isset($name)
33
    {
34
        return isset($this->$name);
35
    }
36
37
    /**
38
     * @param $name
39
     * @return mixed|null
40
     */
41
    public function __get($name)
42
    {
43
        if (property_exists($this, $name)) {
44
            return $this->$name;
45
        }
46
47
        return null;
48
    }
49
}
50