Completed
Push — master ( b2d8c9...799a4d )
by Tony
01:32
created

ConfigTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 20
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A config() 0 7 2
1
<?php
2
3
namespace ClassConfig\Traits;
4
5
use ClassConfig\AbstractConfig;
6
use ClassConfig\ClassConfig;
7
8
/**
9
 * Trait ConfigTrait
10
 * @package ClassConfig\Traits
11
 */
12
trait ConfigTrait
13
{
14
    /**
15
     * @var AbstractConfig
16
     */
17
    protected $__config__;
18
19
    /**
20
     * @return AbstractConfig
21
     * @throws \Doctrine\Common\Annotations\AnnotationException
22
     * @throws \ReflectionException
23
     */
24
    protected function config(): AbstractConfig
25
    {
26
        if (!isset($this->__config__)) {
27
            $this->__config__ = ClassConfig::createInstance(get_class($this));
28
        }
29
        return $this->__config__;
30
    }
31
}