Completed
Push — master ( 23299f...b8bcfc )
by butschster
22s queued 19s
created
src/Core/src/Traits/Config/AliasTrait.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,10 @@
 block discarded – undo
23 23
     public function resolveAlias(string $alias): string
24 24
     {
25 25
         $antiCircleReference = [];
26
-        while (is_string($alias) && isset($this->config) && isset($this->config['aliases'][$alias])) {
27
-            if (\in_array($alias, $antiCircleReference, true)) {
26
+        while (is_string($alias) && isset($this->config) && isset($this->config['aliases'][$alias]))
27
+        {
28
+            if (\in_array($alias, $antiCircleReference, true))
29
+            {
28 30
                 throw new ContainerException("Circle reference detected for alias `$alias`.");
29 31
             }
30 32
             $antiCircleReference[] = $alias;
Please login to merge, or discard this patch.
src/Framework/Bootloader/Http/HttpBootloader.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -81,12 +81,15 @@
 block discarded – undo
81 81
             $kernel->addDispatcher($factory->make(SapiDispatcher::class));
82 82
         });
83 83
 
84
-        if (!class_exists('Spiral\RoadRunnerBridge\Http\Dispatcher')) {
85
-            if (class_exists(PSR7Client::class)) {
84
+        if (!class_exists('Spiral\RoadRunnerBridge\Http\Dispatcher'))
85
+        {
86
+            if (class_exists(PSR7Client::class))
87
+            {
86 88
                 $kernel->addDispatcher($factory->make(LegacyRrDispatcher::class));
87 89
             }
88 90
 
89
-            if (class_exists(PSR7Worker::class)) {
91
+            if (class_exists(PSR7Worker::class))
92
+            {
90 93
                 $kernel->addDispatcher($factory->make(RrDispatcher::class));
91 94
             }
92 95
         }
Please login to merge, or discard this patch.
src/Boot/src/BootloadManager.php 1 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);
@@ -94,7 +95,8 @@  discard block
 block discarded – undo
94 95
      */
95 96
     protected function initBootloader(BootloaderInterface $bootloader): iterable
96 97
     {
97
-        if ($bootloader instanceof DependedInterface) {
98
+        if ($bootloader instanceof DependedInterface)
99
+        {
98 100
             yield from $this->initBootloaders($bootloader->defineDependencies());
99 101
         }
100 102
 
@@ -111,30 +113,37 @@  discard block
 block discarded – undo
111 113
      */
112 114
     private function initBootloaders(array $classes): \Generator
113 115
     {
114
-        foreach ($classes as $class => $options) {
116
+        foreach ($classes as $class => $options)
117
+        {
115 118
             // default bootload syntax as simple array
116
-            if (\is_string($options)) {
119
+            if (\is_string($options))
120
+            {
117 121
                 $class = $options;
118 122
                 $options = [];
119 123
             }
120 124
 
121 125
             // Replace class aliases with source classes
122
-            try {
126
+            try
127
+            {
123 128
                 $class = (new \ReflectionClass($class))->getName();
124
-            } catch (\ReflectionException $e) {
129
+            }
130
+            catch (\ReflectionException $e)
131
+            {
125 132
                 throw new ClassNotFoundException(
126 133
                     \sprintf('Bootloader class `%s` is not exist.', $class)
127 134
                 );
128 135
             }
129 136
 
130
-            if (\in_array($class, $this->classes, true)) {
137
+            if (\in_array($class, $this->classes, true))
138
+            {
131 139
                 continue;
132 140
             }
133 141
 
134 142
             $this->classes[] = $class;
135 143
             $bootloader = $this->container->get($class);
136 144
 
137
-            if (!$bootloader instanceof BootloaderInterface) {
145
+            if (!$bootloader instanceof BootloaderInterface)
146
+            {
138 147
                 continue;
139 148
             }
140 149
 
@@ -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.
src/Bridge/Monolog/src/Bootloader/MonologBootloader.php 1 patch
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -48,18 +48,22 @@  discard block
 block discarded – undo
48 48
     public function boot(Container $container, FinalizerInterface $finalizer): void
49 49
     {
50 50
         $finalizer->addFinalizer(static function () use ($container): void {
51
-            if ($container->hasInstance(LoggerInterface::class)) {
51
+            if ($container->hasInstance(LoggerInterface::class))
52
+            {
52 53
                 $logger = $container->get(LoggerInterface::class);
53 54
 
54
-                if ($logger instanceof ResettableInterface) {
55
+                if ($logger instanceof ResettableInterface)
56
+                {
55 57
                     $logger->reset();
56 58
                 }
57 59
             }
58 60
 
59
-            if ($container->hasInstance(LogsInterface::class)) {
61
+            if ($container->hasInstance(LogsInterface::class))
62
+            {
60 63
                 $factory = $container->get(LogsInterface::class);
61 64
 
62
-                if ($factory instanceof ResettableInterface) {
65
+                if ($factory instanceof ResettableInterface)
66
+                {
63 67
                     $factory->reset();
64 68
                 }
65 69
             }
@@ -77,7 +81,8 @@  discard block
 block discarded – undo
77 81
     {
78 82
         $name = MonologConfig::CONFIG;
79 83
 
80
-        if (!isset($this->config->getConfig($name)['handlers'][$channel])) {
84
+        if (!isset($this->config->getConfig($name)['handlers'][$channel]))
85
+        {
81 86
             $this->config->modify($name, new Append('handlers', $channel, []));
82 87
         }
83 88
 
Please login to merge, or discard this patch.
src/Bridge/Monolog/src/LogFactory.php 1 patch
Braces   +26 added lines, -12 removed lines patch added patch discarded remove patch
@@ -62,8 +62,10 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public function getLogger(string $channel = null): LoggerInterface
64 64
     {
65
-        if ($channel === null || $channel == self::DEFAULT) {
66
-            if ($this->default !== null) {
65
+        if ($channel === null || $channel == self::DEFAULT)
66
+        {
67
+            if ($this->default !== null)
68
+            {
67 69
                 // we should use only one default logger per system
68 70
                 return $this->default;
69 71
             }
@@ -93,7 +95,8 @@  discard block
 block discarded – undo
93 95
 
94 96
     public function reset()
95 97
     {
96
-        if ($this->default instanceof ResettableInterface) {
98
+        if ($this->default instanceof ResettableInterface)
99
+        {
97 100
             $this->default->reset();
98 101
         }
99 102
     }
@@ -111,15 +114,20 @@  discard block
 block discarded – undo
111 114
         // always include default handler
112 115
         $handlers = [];
113 116
 
114
-        foreach ($this->config->getHandlers($channel) as $handler) {
115
-            if (!$handler instanceof Autowire) {
117
+        foreach ($this->config->getHandlers($channel) as $handler)
118
+        {
119
+            if (!$handler instanceof Autowire)
120
+            {
116 121
                 $handlers[] = $handler;
117 122
                 continue;
118 123
             }
119 124
 
120
-            try {
125
+            try
126
+            {
121 127
                 $handlers[] = $handler->resolve($this->factory);
122
-            } catch (ContainerExceptionInterface $e) {
128
+            }
129
+            catch (ContainerExceptionInterface $e)
130
+            {
123 131
                 throw new ConfigException($e->getMessage(), $e->getCode(), $e);
124 132
             }
125 133
         }
@@ -138,20 +146,26 @@  discard block
 block discarded – undo
138 146
     protected function getProcessors(string $channel): array
139 147
     {
140 148
         $processors = [];
141
-        foreach ($this->config->getProcessors($channel) as $processor) {
142
-            if (!$processor instanceof Autowire) {
149
+        foreach ($this->config->getProcessors($channel) as $processor)
150
+        {
151
+            if (!$processor instanceof Autowire)
152
+            {
143 153
                 $processors[] = $processor;
144 154
                 continue;
145 155
             }
146 156
 
147
-            try {
157
+            try
158
+            {
148 159
                 $processors[] = $processor->resolve($this->factory);
149
-            } catch (ContainerExceptionInterface $e) {
160
+            }
161
+            catch (ContainerExceptionInterface $e)
162
+            {
150 163
                 throw new ConfigException($e->getMessage(), $e->getCode(), $e);
151 164
             }
152 165
         }
153 166
 
154
-        if ($processors === []) {
167
+        if ($processors === [])
168
+        {
155 169
             $processors[] = new PsrLogMessageProcessor();
156 170
         }
157 171
 
Please login to merge, or discard this patch.
src/Queue/src/Job/ObjectJob.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,11 +20,13 @@
 block discarded – undo
20 20
 
21 21
     public function handle(string $name, string $id, array $payload): void
22 22
     {
23
-        if (!isset($payload['object'])) {
23
+        if (!isset($payload['object']))
24
+        {
24 25
             throw new InvalidArgumentException('Payload `object` key is required.');
25 26
         }
26 27
 
27
-        if (!is_object($payload['object'])) {
28
+        if (!is_object($payload['object']))
29
+        {
28 30
             throw new InvalidArgumentException('Payload `object` key value type should be an object.');
29 31
         }
30 32
 
Please login to merge, or discard this patch.
src/Queue/src/Job/CallableJob.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,11 +20,13 @@
 block discarded – undo
20 20
 
21 21
     public function handle(string $name, string $id, array $payload): void
22 22
     {
23
-        if (!isset($payload['callback'])) {
23
+        if (!isset($payload['callback']))
24
+        {
24 25
             throw new InvalidArgumentException('Payload `callback` key is required.');
25 26
         }
26 27
 
27
-        if (!$payload['callback'] instanceof \Closure) {
28
+        if (!$payload['callback'] instanceof \Closure)
29
+        {
28 30
             throw new InvalidArgumentException('Payload `callback` key value type should be a closure.');
29 31
         }
30 32
 
Please login to merge, or discard this patch.
src/SendIt/src/MailJob.php 1 patch
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -48,11 +48,13 @@  discard block
 block discarded – undo
48 48
      */
49 49
     public function handle(string $name, string $id, $payload): void
50 50
     {
51
-        if (\is_string($payload)) {
51
+        if (\is_string($payload))
52
+        {
52 53
             $payload = json_decode($payload, true);
53 54
         }
54 55
 
55
-        if (!\is_array($payload)) {
56
+        if (!\is_array($payload))
57
+        {
56 58
             throw new InvalidArgumentException('Mail job payload should be an array.');
57 59
         }
58 60
 
@@ -60,15 +62,19 @@  discard block
 block discarded – undo
60 62
 
61 63
         $email = $this->renderer->render($message);
62 64
 
63
-        if ($email->getFrom() === []) {
65
+        if ($email->getFrom() === [])
66
+        {
64 67
             $email->from(Address::create($this->config->getFromAddress()));
65 68
         }
66 69
 
67 70
         $recipients = $this->getRecipients($email);
68 71
 
69
-        try {
72
+        try
73
+        {
70 74
             $this->mailer->send($email);
71
-        } catch (TransportExceptionInterface $e) {
75
+        }
76
+        catch (TransportExceptionInterface $e)
77
+        {
72 78
             $this->getLogger()->error(
73 79
                 sprintf(
74 80
                     'Failed to send `%s` to "%s": %s',
@@ -98,7 +104,8 @@  discard block
 block discarded – undo
98 104
 
99 105
         $addresses = array_merge($message->getTo(), $message->getCc(), $message->getBcc());
100 106
 
101
-        foreach ($addresses as $address) {
107
+        foreach ($addresses as $address)
108
+        {
102 109
             $emails[] = $address->toString();
103 110
         }
104 111
 
Please login to merge, or discard this patch.