InitializationTrait   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 37
c 0
b 0
f 0
wmc 3
lcom 1
cbo 0
ccs 7
cts 7
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
__initialize() 0 1 ?
A initializeInternalReflection() 0 7 2
A isInitialized() 0 4 1
1
<?php
2
/**
3
 * Parser Reflection API
4
 *
5
 * @copyright Copyright 2015, Lisachenko Alexander <[email protected]>
6
 *
7
 * This source file is subject to the license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
11
namespace Go\ParserReflection\Traits;
12
13
14
trait InitializationTrait
15
{
16
    /**
17
     * Is internal reflection is initialized or not
18
     *
19
     * @var boolean
20
     */
21
    private $isInitialized = false;
22
23
    /**
24
     * Initializes internal reflection for calling misc runtime methods
25
     */
26 143
    public function initializeInternalReflection()
27
    {
28 143
        if (!$this->isInitialized) {
29 79
            $this->__initialize();
30 79
            $this->isInitialized = true;
31
        }
32 143
    }
33
34
    /**
35
     * Returns the status of initialization status for internal object
36
     *
37
     * @return bool
38
     */
39 30
    public function isInitialized()
40
    {
41 30
        return $this->isInitialized;
42
    }
43
44
    /**
45
     * Implementation of internal reflection initialization
46
     *
47
     * @return void
48
     */
49
    abstract protected function __initialize();
50
}
51