Passed
Push — master ( 456cc4...4a5fe5 )
by Hector Luis
22:19
created

Getter   A

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
 * @package     Ticaje_Base
8
 * @author      Hector Luis Barrientos <[email protected]>
9
 */
10
11
namespace Ticaje\Base\Traits;
12
13
/**
14
 * Trait Getter
15
 * @package Ticaje\Base\Traits
16
 */
17
trait Getter
18
{
19
    /**
20
     * @param $name
21
     * @return null
22
     * Redefine magic set method so object using an instance of this one can access properties very simple
23
     */
24
    public function __get($name)
25
    {
26
        if (method_exists($this, $name)) {
27
            return $this->$name();
28
        } elseif (property_exists($this, $name)) {
29
            return $this->$name;
30
        }
31
        return null;
32
    }
33
}
34