Getter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 6
c 1
b 0
f 0
dl 0
loc 15
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __get() 0 8 3
1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * Base Trait
6
 * @category    Ticaje
7
 * @author      Max Demian <[email protected]>
8
 */
9
10
namespace Ticaje\Contract\Traits;
11
12
/**
13
 * Trait Getter
14
 * @package Ticaje\Contract\Traits
15
 */
16
trait Getter
17
{
18
    /**
19
     * @param $name
20
     * @return null
21
     * Redefine magic set method so object using an instance of this one can access properties very simple
22
     */
23
    public function __get($name)
24
    {
25
        if (method_exists($this, $name)) {
26
            return $this->$name();
27
        } elseif (property_exists($this, $name)) {
28
            return $this->$name;
29
        }
30
        return null;
31
    }
32
}
33