Passed
Push — master ( 70ddb4...b80013 )
by butschster
06:45 queued 12s
created
src/Boot/src/BootloadManager.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
         $this->fireCallbacks($startingCallbacks);
82 82
 
83
-        foreach ($bootloaders as $data) {
83
+        foreach ($bootloaders as $data){
84 84
             $bootloader = $data['bootloader'];
85 85
             $options = $data['options'];
86 86
             $this->invokeBootloader($bootloader, 'start', $options);
@@ -96,30 +96,30 @@  discard block
 block discarded – undo
96 96
      */
97 97
     private function initBootloaders(array $classes): \Generator
98 98
     {
99
-        foreach ($classes as $class => $options) {
99
+        foreach ($classes as $class => $options){
100 100
             // default bootload syntax as simple array
101
-            if (\is_string($options)) {
101
+            if (\is_string($options)){
102 102
                 $class = $options;
103 103
                 $options = [];
104 104
             }
105 105
 
106 106
             // Replace class aliases with source classes
107
-            try {
107
+            try{
108 108
                 $class = (new \ReflectionClass($class))->getName();
109
-            } catch (\ReflectionException $e) {
109
+            }catch (\ReflectionException $e){
110 110
                 throw new ClassNotFoundException(
111 111
                     \sprintf('Bootloader class `%s` is not exist.', $class)
112 112
                 );
113 113
             }
114 114
 
115
-            if (\in_array($class, $this->classes, true)) {
115
+            if (\in_array($class, $this->classes, true)){
116 116
                 continue;
117 117
             }
118 118
 
119 119
             $this->classes[] = $class;
120 120
             $bootloader = $this->container->get($class);
121 121
 
122
-            if (! $bootloader instanceof BootloaderInterface) {
122
+            if (!$bootloader instanceof BootloaderInterface){
123 123
                 continue;
124 124
             }
125 125
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
      */
136 136
     protected function initBootloader(BootloaderInterface $bootloader): iterable
137 137
     {
138
-        if ($bootloader instanceof DependedInterface) {
138
+        if ($bootloader instanceof DependedInterface){
139 139
             yield from $this->initBootloaders($bootloader->defineDependencies());
140 140
         }
141 141
 
@@ -150,11 +150,11 @@  discard block
 block discarded – undo
150 150
      */
151 151
     private function initBindings(array $bindings, array $singletons): void
152 152
     {
153
-        foreach ($bindings as $aliases => $resolver) {
153
+        foreach ($bindings as $aliases => $resolver){
154 154
             $this->container->bind($aliases, $resolver);
155 155
         }
156 156
 
157
-        foreach ($singletons as $aliases => $resolver) {
157
+        foreach ($singletons as $aliases => $resolver){
158 158
             $this->container->bindSingleton($aliases, $resolver);
159 159
         }
160 160
     }
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
     private function invokeBootloader(BootloaderInterface $bootloader, string $method, array $options): void
163 163
     {
164 164
         $refl = new \ReflectionClass($bootloader);
165
-        if (! $refl->hasMethod($method)) {
165
+        if (!$refl->hasMethod($method)){
166 166
             return;
167 167
         }
168 168
 
169 169
         $boot = new \ReflectionMethod($bootloader, $method);
170 170
 
171 171
         $args = $this->container->resolveArguments($boot);
172
-        if (! isset($args['boot'])) {
172
+        if (!isset($args['boot'])){
173 173
             $args['boot'] = $options;
174 174
         }
175 175
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
      */
182 182
     private function fireCallbacks(array $callbacks): void
183 183
     {
184
-        foreach ($callbacks as $callback) {
184
+        foreach ($callbacks as $callback){
185 185
             $this->container->invoke($callback);
186 186
         }
187 187
     }
Please login to merge, or discard this patch.
Braces   +27 added lines, -13 removed lines patch added patch discarded remove patch
@@ -80,7 +80,8 @@  discard block
 block discarded – undo
80 80
 
81 81
         $this->fireCallbacks($startingCallbacks);
82 82
 
83
-        foreach ($bootloaders as $data) {
83
+        foreach ($bootloaders as $data)
84
+        {
84 85
             $bootloader = $data['bootloader'];
85 86
             $options = $data['options'];
86 87
             $this->invokeBootloader($bootloader, 'start', $options);
@@ -96,30 +97,37 @@  discard block
 block discarded – undo
96 97
      */
97 98
     private function initBootloaders(array $classes): \Generator
98 99
     {
99
-        foreach ($classes as $class => $options) {
100
+        foreach ($classes as $class => $options)
101
+        {
100 102
             // default bootload syntax as simple array
101
-            if (\is_string($options)) {
103
+            if (\is_string($options))
104
+            {
102 105
                 $class = $options;
103 106
                 $options = [];
104 107
             }
105 108
 
106 109
             // Replace class aliases with source classes
107
-            try {
110
+            try
111
+            {
108 112
                 $class = (new \ReflectionClass($class))->getName();
109
-            } catch (\ReflectionException $e) {
113
+            }
114
+            catch (\ReflectionException $e)
115
+            {
110 116
                 throw new ClassNotFoundException(
111 117
                     \sprintf('Bootloader class `%s` is not exist.', $class)
112 118
                 );
113 119
             }
114 120
 
115
-            if (\in_array($class, $this->classes, true)) {
121
+            if (\in_array($class, $this->classes, true))
122
+            {
116 123
                 continue;
117 124
             }
118 125
 
119 126
             $this->classes[] = $class;
120 127
             $bootloader = $this->container->get($class);
121 128
 
122
-            if (! $bootloader instanceof BootloaderInterface) {
129
+            if (! $bootloader instanceof BootloaderInterface)
130
+            {
123 131
                 continue;
124 132
             }
125 133
 
@@ -135,7 +143,8 @@  discard block
 block discarded – undo
135 143
      */
136 144
     protected function initBootloader(BootloaderInterface $bootloader): iterable
137 145
     {
138
-        if ($bootloader instanceof DependedInterface) {
146
+        if ($bootloader instanceof DependedInterface)
147
+        {
139 148
             yield from $this->initBootloaders($bootloader->defineDependencies());
140 149
         }
141 150
 
@@ -150,11 +159,13 @@  discard block
 block discarded – undo
150 159
      */
151 160
     private function initBindings(array $bindings, array $singletons): void
152 161
     {
153
-        foreach ($bindings as $aliases => $resolver) {
162
+        foreach ($bindings as $aliases => $resolver)
163
+        {
154 164
             $this->container->bind($aliases, $resolver);
155 165
         }
156 166
 
157
-        foreach ($singletons as $aliases => $resolver) {
167
+        foreach ($singletons as $aliases => $resolver)
168
+        {
158 169
             $this->container->bindSingleton($aliases, $resolver);
159 170
         }
160 171
     }
@@ -162,14 +173,16 @@  discard block
 block discarded – undo
162 173
     private function invokeBootloader(BootloaderInterface $bootloader, string $method, array $options): void
163 174
     {
164 175
         $refl = new \ReflectionClass($bootloader);
165
-        if (! $refl->hasMethod($method)) {
176
+        if (! $refl->hasMethod($method))
177
+        {
166 178
             return;
167 179
         }
168 180
 
169 181
         $boot = new \ReflectionMethod($bootloader, $method);
170 182
 
171 183
         $args = $this->container->resolveArguments($boot);
172
-        if (! isset($args['boot'])) {
184
+        if (! isset($args['boot']))
185
+        {
173 186
             $args['boot'] = $options;
174 187
         }
175 188
 
@@ -181,7 +194,8 @@  discard block
 block discarded – undo
181 194
      */
182 195
     private function fireCallbacks(array $callbacks): void
183 196
     {
184
-        foreach ($callbacks as $callback) {
197
+        foreach ($callbacks as $callback)
198
+        {
185 199
             $this->container->invoke($callback);
186 200
         }
187 201
     }
Please login to merge, or discard this patch.