Completed
Push — master ( 64cebd...18da58 )
by Vitaliy
03:43
created
source/LazyInitStaticTrait.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,18 +28,18 @@
 block discarded – undo
28 28
      *
29 29
      * @throws ErrorException
30 30
      */
31
-    protected static function lazyInitStatic ( Closure $container, $dependency = null, array $params = [ ] )
31
+    protected static function lazyInitStatic(Closure $container, $dependency = null, array $params = [ ])
32 32
     {
33 33
         /** @var string $key */
34
-        if ( $dependency === null ) {
34
+        if ($dependency === null) {
35 35
             $key = LazyInitHelper::createBacktraceKey();
36
-        } elseif ( is_array( $dependency ) ) {
37
-            $key = LazyInitHelper::createDependencyKey( $dependency );
36
+        } elseif (is_array($dependency)) {
37
+            $key = LazyInitHelper::createDependencyKey($dependency);
38 38
         } else {
39 39
             $key = $dependency;
40 40
         }
41
-        if ( !array_key_exists( $key, static::$lazyInitStaticData ) ) {
42
-            static::$lazyInitStaticData[ $key ] = call_user_func_array( $container, $params );
41
+        if (!array_key_exists($key, static::$lazyInitStaticData)) {
42
+            static::$lazyInitStaticData[ $key ] = call_user_func_array($container, $params);
43 43
         }
44 44
 
45 45
         return static::$lazyInitStaticData[ $key ];
Please login to merge, or discard this patch.
source/LazyInitHelper.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
      *
31 31
      * @throws ErrorException
32 32
      */
33
-    public static function lazyInit ( Closure $closure, $key = null, array $params = [ ] )
33
+    public static function lazyInit(Closure $closure, $key = null, array $params = [ ])
34 34
     {
35
-        if ( $key === null ) {
35
+        if ($key === null) {
36 36
             $key = static::createBacktraceKey();
37 37
         }
38 38
 
39
-        return static::lazyInitStatic( $closure, $key, $params );
39
+        return static::lazyInitStatic($closure, $key, $params);
40 40
     }
41 41
 
42 42
     /**
@@ -46,11 +46,11 @@  discard block
 block discarded – undo
46 46
      *
47 47
      * @throws ErrorException
48 48
      */
49
-    public static function createBacktraceKey ( $backtraceDepth = 3 )
49
+    public static function createBacktraceKey($backtraceDepth = 3)
50 50
     {
51 51
         return implode(
52 52
             static::PART_SEPARATOR,
53
-            static::createBacktraceData( $backtraceDepth )
53
+            static::createBacktraceData($backtraceDepth)
54 54
         );
55 55
     }
56 56
 
@@ -61,18 +61,18 @@  discard block
 block discarded – undo
61 61
      *
62 62
      * @throws ErrorException
63 63
      */
64
-    public static function createBacktraceData ( $backtraceDepth = 0 )
64
+    public static function createBacktraceData($backtraceDepth = 0)
65 65
     {
66
-        $backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, $backtraceDepth );
66
+        $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, $backtraceDepth);
67 67
         $backtraceKey = $backtraceDepth - 1;
68
-        if ( isset( $backtrace[ $backtraceKey ][ 'file' ], $backtrace[ $backtraceKey ][ 'line' ] ) ) {
68
+        if (isset($backtrace[ $backtraceKey ][ 'file' ], $backtrace[ $backtraceKey ][ 'line' ])) {
69 69
             $parts = [ ];
70
-            $parts[] = $backtrace[ $backtraceKey ][ 'file' ];
71
-            $parts[] = $backtrace[ $backtraceKey ][ 'line' ];
70
+            $parts[ ] = $backtrace[ $backtraceKey ][ 'file' ];
71
+            $parts[ ] = $backtrace[ $backtraceKey ][ 'line' ];
72 72
 
73 73
             return $parts;
74 74
         }
75
-        throw new ErrorException( 'Unable to create BacktraceData.' );
75
+        throw new ErrorException('Unable to create BacktraceData.');
76 76
     }
77 77
 
78 78
     /**
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
      *
81 81
      * @return string
82 82
      */
83
-    public static function createDependencyKey ( array $dependency )
83
+    public static function createDependencyKey(array $dependency)
84 84
     {
85
-        return md5( serialize( $dependency ) );
85
+        return md5(serialize($dependency));
86 86
     }
87 87
 }
Please login to merge, or discard this patch.
source/LazyInitTrait.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,18 +28,18 @@
 block discarded – undo
28 28
      *
29 29
      * @throws ErrorException
30 30
      */
31
-    protected function lazyInit ( Closure $container, $dependency = null, array $params = [ ] )
31
+    protected function lazyInit(Closure $container, $dependency = null, array $params = [ ])
32 32
     {
33 33
         /** @var string $key */
34
-        if ( $dependency === null ) {
34
+        if ($dependency === null) {
35 35
             $key = LazyInitHelper::createBacktraceKey();
36
-        } elseif ( is_array( $dependency ) ) {
37
-            $key = LazyInitHelper::createDependencyKey( $dependency );
36
+        } elseif (is_array($dependency)) {
37
+            $key = LazyInitHelper::createDependencyKey($dependency);
38 38
         } else {
39 39
             $key = $dependency;
40 40
         }
41
-        if ( !array_key_exists( $key, $this->lazyInitData ) ) {
42
-            $this->lazyInitData[ $key ] = call_user_func_array( $container, $params );
41
+        if (!array_key_exists($key, $this->lazyInitData)) {
42
+            $this->lazyInitData[ $key ] = call_user_func_array($container, $params);
43 43
         }
44 44
 
45 45
         return $this->lazyInitData[ $key ];
Please login to merge, or discard this patch.