Conditions | 4 |
Paths | 6 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
31 | 11 | protected static function lazyInitStatic ( Closure $container, $dependency = null, array $params = [ ] ) |
|
32 | { |
||
33 | /** @var string $key */ |
||
34 | 11 | if ( $dependency === null ) { |
|
35 | 5 | $key = LazyInitHelper::createBacktraceKey(); |
|
36 | 11 | } elseif ( is_array( $dependency ) ) { |
|
37 | 4 | $key = LazyInitHelper::createDependencyKey( $dependency ); |
|
38 | 4 | } else { |
|
39 | 10 | $key = $dependency; |
|
40 | } |
||
41 | 11 | if ( !array_key_exists( $key, static::$lazyInitStaticData ) ) { |
|
42 | 11 | static::$lazyInitStaticData[ $key ] = call_user_func_array( $container, $params ); |
|
43 | 11 | } |
|
44 | |||
45 | 11 | return static::$lazyInitStaticData[ $key ]; |
|
46 | } |
||
47 | } |
||
48 |