Completed
Push — master ( c09ce2...1f44ff )
by Emily
02:06
created

HasReflectorTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 83.33%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 19
ccs 5
cts 6
cp 0.8333
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getReflectionComposite() 0 14 2
1
<?php
2
/**
3
 * This file is part of the Composite Utils package.
4
 *
5
 * (c) Emily Shepherd <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the
8
 * LICENSE.md file that was distributed with this source code.
9
 *
10
 * @package spaark/composite-utils
11
 * @author Emily Shepherd <emily@emilyshepherd>
12
 * @license MIT
13
 */
14
15
namespace Spaark\CompositeUtils\Traits;
16
17
use Spaark\CompositeUtils\Factory\Reflection\ReflectionCompositeFactory;
18
19
trait HasReflectorTrait
20
{
21
    protected static $reflectionComposite;
22
23 4
    protected static function getReflectionComposite()
24
    {
25 4
        if (!static::$reflectionComposite)
26
        {
27
            static::$reflectionComposite =
28 1
                ReflectionCompositeFactory::fromClassName
29
                (
30
                    get_called_class()
31
                )
32 1
                ->build();
33
        }
34
35 4
        return static::$reflectionComposite;
36
    }
37
}
38