Passed
Pull Request — master (#736)
by Abdul Malik
07:17 queued 45s
created
src/Reactor/src/FileDeclaration.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     public function addElement(DeclarationInterface $element): FileDeclaration
81 81
     {
82 82
         $this->elements->add($element);
83
-        if ($element instanceof DependedInterface) {
83
+        if ($element instanceof DependedInterface){
84 84
             $this->addUses($element->getDependencies());
85 85
         }
86 86
 
@@ -105,28 +105,28 @@  discard block
 block discarded – undo
105 105
     {
106 106
         $result = "<?php\n";
107 107
 
108
-        if (!$this->docComment->isEmpty()) {
109
-            $result .= $this->docComment->render($indentLevel) . "\n";
108
+        if (!$this->docComment->isEmpty()){
109
+            $result .= $this->docComment->render($indentLevel)."\n";
110 110
         }
111 111
 
112
-        if ($this->directives !== null && !empty($this->directives->render())) {
113
-            $result .= $this->directives->render() . "\n\n";
112
+        if ($this->directives !== null && !empty($this->directives->render())){
113
+            $result .= $this->directives->render()."\n\n";
114 114
         }
115 115
 
116
-        if (!empty($this->namespace)) {
117
-            if ($this->docComment->isEmpty()) {
116
+        if (!empty($this->namespace)){
117
+            if ($this->docComment->isEmpty()){
118 118
                 $result .= "\n";
119 119
             }
120 120
             $result .= "namespace {$this->namespace};\n\n";
121 121
         }
122 122
 
123
-        if (!empty($this->uses)) {
124
-            $result .= $this->renderUses($indentLevel) . "\n\n";
123
+        if (!empty($this->uses)){
124
+            $result .= $this->renderUses($indentLevel)."\n\n";
125 125
         }
126 126
 
127 127
         $result .= $this->elements->render($indentLevel);
128 128
 
129
-        return $result . "\n";
129
+        return $result."\n";
130 130
     }
131 131
 
132 132
     /**
Please login to merge, or discard this patch.
src/SendIt/src/Bootloader/MailerBootloader.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
     public function start(Container $container): void
71 71
     {
72
-        if ($container->has(JobRegistry::class)) {
72
+        if ($container->has(JobRegistry::class)){
73 73
             // Will be removed since v3.0
74 74
             $registry = $container->get(JobRegistry::class);
75 75
             $registry->setHandler(MailQueue::JOB_NAME, MailJobAdapter::class);
@@ -78,16 +78,16 @@  discard block
 block discarded – undo
78 78
             $container->bindSingleton(
79 79
                 MailerInterface::class,
80 80
                 static function (MailerConfig $config) use ($container) {
81
-                    if ($config->getQueueConnection() === 'sync') {
81
+                    if ($config->getQueueConnection() === 'sync'){
82 82
                         $queue = $container->get(ShortCircuit::class);
83
-                    } else {
83
+                    }else{
84 84
                         $queue = $container->get(QueueInterface::class);
85 85
                     }
86 86
 
87 87
                     return new MailQueue($config, $queue);
88 88
                 }
89 89
             );
90
-        } else {
90
+        }else{
91 91
             $container->bindSingleton(
92 92
                 MailerInterface::class,
93 93
                 static fn (MailerConfig $config, QueueConnectionProviderInterface $provider) => new MailQueue(
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             );
98 98
         }
99 99
 
100
-        if ($container->has(HandlerRegistryInterface::class)) {
100
+        if ($container->has(HandlerRegistryInterface::class)){
101 101
             $registry = $container->get(HandlerRegistryInterface::class);
102 102
             $registry->setHandler(MailQueue::JOB_NAME, MailJob::class);
103 103
         }
Please login to merge, or discard this patch.
Braces   +14 added lines, -6 removed lines patch added patch discarded remove patch
@@ -69,7 +69,8 @@  discard block
 block discarded – undo
69 69
 
70 70
     public function start(Container $container): void
71 71
     {
72
-        if ($container->has(JobRegistry::class)) {
72
+        if ($container->has(JobRegistry::class))
73
+        {
73 74
             // Will be removed since v3.0
74 75
             $registry = $container->get(JobRegistry::class);
75 76
             $registry->setHandler(MailQueue::JOB_NAME, MailJobAdapter::class);
@@ -77,17 +78,23 @@  discard block
 block discarded – undo
77 78
 
78 79
             $container->bindSingleton(
79 80
                 MailerInterface::class,
80
-                static function (MailerConfig $config) use ($container) {
81
-                    if ($config->getQueueConnection() === 'sync') {
81
+                static function (MailerConfig $config) use ($container)
82
+                {
83
+                    if ($config->getQueueConnection() === 'sync')
84
+                    {
82 85
                         $queue = $container->get(ShortCircuit::class);
83
-                    } else {
86
+                    }
87
+                    else
88
+                    {
84 89
                         $queue = $container->get(QueueInterface::class);
85 90
                     }
86 91
 
87 92
                     return new MailQueue($config, $queue);
88 93
                 }
89 94
             );
90
-        } else {
95
+        }
96
+        else
97
+        {
91 98
             $container->bindSingleton(
92 99
                 MailerInterface::class,
93 100
                 static fn (MailerConfig $config, QueueConnectionProviderInterface $provider) => new MailQueue(
@@ -97,7 +104,8 @@  discard block
 block discarded – undo
97 104
             );
98 105
         }
99 106
 
100
-        if ($container->has(HandlerRegistryInterface::class)) {
107
+        if ($container->has(HandlerRegistryInterface::class))
108
+        {
101 109
             $registry = $container->get(HandlerRegistryInterface::class);
102 110
             $registry->setHandler(MailQueue::JOB_NAME, MailJob::class);
103 111
         }
Please login to merge, or discard this patch.
rector.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 
11 11
 return static function (RectorConfig $rectorConfig): void {
12 12
     $rectorConfig->paths([
13
-        __DIR__ . '/src/*/src',
13
+        __DIR__.'/src/*/src',
14 14
     ]);
15 15
 
16 16
     $rectorConfig->importShortClasses(false);
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
         CountOnNullRector::class,
21 21
 
22 22
         RemoveUnusedPrivateMethodRector::class => [
23
-            __DIR__ . '/src/Boot/src/Bootloader/ConfigurationBootloader.php',
24
-            __DIR__ . '/src/Broadcasting/src/Bootloader/BroadcastingBootloader.php',
23
+            __DIR__.'/src/Boot/src/Bootloader/ConfigurationBootloader.php',
24
+            __DIR__.'/src/Broadcasting/src/Bootloader/BroadcastingBootloader.php',
25 25
         ],
26 26
 
27 27
         // deprecated classes
28
-        __DIR__ . '/src/Http/src/Exception/EmitterException.php',
29
-        __DIR__ . '/src/Dumper/src/Exception/DumperException.php',
28
+        __DIR__.'/src/Http/src/Exception/EmitterException.php',
29
+        __DIR__.'/src/Dumper/src/Exception/DumperException.php',
30 30
     ]);
31 31
     $rectorConfig->sets([LevelSetList::UP_TO_PHP_74, SetList::DEAD_CODE]);
32 32
 };
Please login to merge, or discard this patch.
src/Queue/src/DefaultSerializer.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
      */
19 19
     public function serialize(array $payload): string
20 20
     {
21
-        try {
21
+        try{
22 22
             return serialize($payload);
23
-        } catch (\Throwable $e) {
23
+        }catch (\Throwable $e){
24 24
             throw new SerializationException($e->getMessage(), (int)$e->getCode(), $e);
25 25
         }
26 26
     }
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function deserialize(string $payload): array
32 32
     {
33
-        try {
33
+        try{
34 34
             return (array)unserialize($payload);
35
-        } catch (\Throwable $e) {
35
+        }catch (\Throwable $e){
36 36
             throw new SerializationException($e->getMessage(), (int)$e->getCode(), $e);
37 37
         }
38 38
     }
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,9 +18,12 @@  discard block
 block discarded – undo
18 18
      */
19 19
     public function serialize(array $payload): string
20 20
     {
21
-        try {
21
+        try
22
+        {
22 23
             return serialize($payload);
23
-        } catch (\Throwable $e) {
24
+        }
25
+        catch (\Throwable $e)
26
+        {
24 27
             throw new SerializationException($e->getMessage(), (int)$e->getCode(), $e);
25 28
         }
26 29
     }
@@ -30,9 +33,12 @@  discard block
 block discarded – undo
30 33
      */
31 34
     public function deserialize(string $payload): array
32 35
     {
33
-        try {
36
+        try
37
+        {
34 38
             return (array)unserialize($payload);
35
-        } catch (\Throwable $e) {
39
+        }
40
+        catch (\Throwable $e)
41
+        {
36 42
             throw new SerializationException($e->getMessage(), (int)$e->getCode(), $e);
37 43
         }
38 44
     }
Please login to merge, or discard this patch.
src/Router/src/CoreHandler.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         CoreInterface $core,
50 50
         ScopeInterface $scope,
51 51
         ResponseFactoryInterface $responseFactory
52
-    ) {
52
+    ){
53 53
         $this->core = $core;
54 54
         $this->scope = $scope;
55 55
         $this->responseFactory = $responseFactory;
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      */
88 88
     public function handle(Request $request): Response
89 89
     {
90
-        if ($this->controller === null) {
90
+        if ($this->controller === null){
91 91
             throw new HandlerException('Controller and action pair is not set');
92 92
         }
93 93
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         $output = $result = null;
98 98
 
99 99
         $response = $this->responseFactory->createResponse(200);
100
-        try {
100
+        try{
101 101
             // run the core withing PSR-7 Request/Response scope
102 102
             $result = $this->scope->runScope(
103 103
                 [
@@ -110,29 +110,29 @@  discard block
 block discarded – undo
110 110
                     $this->parameters
111 111
                 )
112 112
             );
113
-        } catch (ControllerException $e) {
113
+        }catch (ControllerException $e){
114 114
             ob_get_clean();
115 115
             throw $this->mapException($e);
116
-        } catch (\Throwable $e) {
116
+        }catch (\Throwable $e){
117 117
             ob_get_clean();
118 118
             throw $e;
119
-        } finally {
120
-            while (ob_get_level() > $outputLevel + 1) {
121
-                $output = ob_get_clean() . $output;
119
+        }finally{
120
+            while (ob_get_level() > $outputLevel + 1){
121
+                $output = ob_get_clean().$output;
122 122
             }
123 123
         }
124 124
 
125 125
         return $this->wrapResponse(
126 126
             $response,
127 127
             $result,
128
-            ob_get_clean() . $output
128
+            ob_get_clean().$output
129 129
         );
130 130
     }
131 131
 
132 132
     private function getAction(Request $request): string
133 133
     {
134
-        if ($this->verbActions) {
135
-            return strtolower($request->getMethod()) . ucfirst($this->action);
134
+        if ($this->verbActions){
135
+            return strtolower($request->getMethod()).ucfirst($this->action);
136 136
         }
137 137
 
138 138
         return $this->action;
@@ -147,21 +147,21 @@  discard block
 block discarded – undo
147 147
      */
148 148
     private function wrapResponse(Response $response, $result = null, string $output = ''): Response
149 149
     {
150
-        if ($result instanceof Response) {
151
-            if ($output !== '' && $result->getBody()->isWritable()) {
150
+        if ($result instanceof Response){
151
+            if ($output !== '' && $result->getBody()->isWritable()){
152 152
                 $result->getBody()->write($output);
153 153
             }
154 154
 
155 155
             return $result;
156 156
         }
157 157
 
158
-        if ($result instanceof \Generator) {
158
+        if ($result instanceof \Generator){
159 159
             return $response->withBody(new GeneratorStream($result));
160 160
         }
161 161
 
162
-        if (\is_array($result) || $result instanceof \JsonSerializable) {
162
+        if (\is_array($result) || $result instanceof \JsonSerializable){
163 163
             $response = $this->writeJson($response, $result);
164
-        } else {
164
+        }else{
165 165
             $response->getBody()->write((string)$result);
166 166
         }
167 167
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
      */
177 177
     private function mapException(ControllerException $exception): ClientException
178 178
     {
179
-        switch ($exception->getCode()) {
179
+        switch ($exception->getCode()){
180 180
             case ControllerException::BAD_ACTION:
181 181
             case ControllerException::NOT_FOUND:
182 182
                 return new NotFoundException($exception->getMessage());
Please login to merge, or discard this patch.
Braces   +30 added lines, -13 removed lines patch added patch discarded remove patch
@@ -87,7 +87,8 @@  discard block
 block discarded – undo
87 87
      */
88 88
     public function handle(Request $request): Response
89 89
     {
90
-        if ($this->controller === null) {
90
+        if ($this->controller === null)
91
+        {
91 92
             throw new HandlerException('Controller and action pair is not set');
92 93
         }
93 94
 
@@ -97,7 +98,8 @@  discard block
 block discarded – undo
97 98
         $output = $result = null;
98 99
 
99 100
         $response = $this->responseFactory->createResponse(200);
100
-        try {
101
+        try
102
+        {
101 103
             // run the core withing PSR-7 Request/Response scope
102 104
             $result = $this->scope->runScope(
103 105
                 [
@@ -110,14 +112,21 @@  discard block
 block discarded – undo
110 112
                     $this->parameters
111 113
                 )
112 114
             );
113
-        } catch (ControllerException $e) {
115
+        }
116
+        catch (ControllerException $e)
117
+        {
114 118
             ob_get_clean();
115 119
             throw $this->mapException($e);
116
-        } catch (\Throwable $e) {
120
+        }
121
+        catch (\Throwable $e)
122
+        {
117 123
             ob_get_clean();
118 124
             throw $e;
119
-        } finally {
120
-            while (ob_get_level() > $outputLevel + 1) {
125
+        }
126
+        finally
127
+        {
128
+            while (ob_get_level() > $outputLevel + 1)
129
+            {
121 130
                 $output = ob_get_clean() . $output;
122 131
             }
123 132
         }
@@ -131,7 +140,8 @@  discard block
 block discarded – undo
131 140
 
132 141
     private function getAction(Request $request): string
133 142
     {
134
-        if ($this->verbActions) {
143
+        if ($this->verbActions)
144
+        {
135 145
             return strtolower($request->getMethod()) . ucfirst($this->action);
136 146
         }
137 147
 
@@ -147,21 +157,27 @@  discard block
 block discarded – undo
147 157
      */
148 158
     private function wrapResponse(Response $response, $result = null, string $output = ''): Response
149 159
     {
150
-        if ($result instanceof Response) {
151
-            if ($output !== '' && $result->getBody()->isWritable()) {
160
+        if ($result instanceof Response)
161
+        {
162
+            if ($output !== '' && $result->getBody()->isWritable())
163
+            {
152 164
                 $result->getBody()->write($output);
153 165
             }
154 166
 
155 167
             return $result;
156 168
         }
157 169
 
158
-        if ($result instanceof \Generator) {
170
+        if ($result instanceof \Generator)
171
+        {
159 172
             return $response->withBody(new GeneratorStream($result));
160 173
         }
161 174
 
162
-        if (\is_array($result) || $result instanceof \JsonSerializable) {
175
+        if (\is_array($result) || $result instanceof \JsonSerializable)
176
+        {
163 177
             $response = $this->writeJson($response, $result);
164
-        } else {
178
+        }
179
+        else
180
+        {
165 181
             $response->getBody()->write((string)$result);
166 182
         }
167 183
 
@@ -176,7 +192,8 @@  discard block
 block discarded – undo
176 192
      */
177 193
     private function mapException(ControllerException $exception): ClientException
178 194
     {
179
-        switch ($exception->getCode()) {
195
+        switch ($exception->getCode())
196
+        {
180 197
             case ControllerException::BAD_ACTION:
181 198
             case ControllerException::NOT_FOUND:
182 199
                 return new NotFoundException($exception->getMessage());
Please login to merge, or discard this patch.
src/Hmvc/src/AbstractCore.php 1 patch
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -42,9 +42,12 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function callAction(string $controller, string $action, array $parameters = [])
44 44
     {
45
-        try {
45
+        try
46
+        {
46 47
             $method = new \ReflectionMethod($controller, $action);
47
-        } catch (\ReflectionException $e) {
48
+        }
49
+        catch (\ReflectionException $e)
50
+        {
48 51
             throw new ControllerException(
49 52
                 "Invalid action `{$controller}`->`{$action}`",
50 53
                 ControllerException::BAD_ACTION,
@@ -52,22 +55,28 @@  discard block
 block discarded – undo
52 55
             );
53 56
         }
54 57
 
55
-        if ($method->isStatic() || !$method->isPublic()) {
58
+        if ($method->isStatic() || !$method->isPublic())
59
+        {
56 60
             throw new ControllerException(
57 61
                 "Invalid action `{$controller}`->`{$action}`",
58 62
                 ControllerException::BAD_ACTION
59 63
             );
60 64
         }
61 65
 
62
-        try {
66
+        try
67
+        {
63 68
             // getting the set of arguments should be sent to requested method
64 69
             $args = $this->resolver->resolveArguments($method, $parameters);
65
-        } catch (ArgumentException $e) {
70
+        }
71
+        catch (ArgumentException $e)
72
+        {
66 73
             throw new ControllerException(
67 74
                 "Missing/invalid parameter '{$e->getParameter()->name}' of  `{$controller}`->`{$action}`",
68 75
                 ControllerException::BAD_ARGUMENT
69 76
             );
70
-        } catch (ContainerExceptionInterface $e) {
77
+        }
78
+        catch (ContainerExceptionInterface $e)
79
+        {
71 80
             throw new ControllerException(
72 81
                 $e->getMessage(),
73 82
                 ControllerException::ERROR,
Please login to merge, or discard this patch.
src/Storage/src/Storage.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     {
71 71
         $name ??= $this->default;
72 72
 
73
-        if (!isset($this->buckets[$name])) {
73
+        if (!isset($this->buckets[$name])){
74 74
             throw new InvalidArgumentException(\sprintf(self::ERROR_NOT_FOUND, $name));
75 75
         }
76 76
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function add(string $name, BucketInterface $storage, bool $overwrite = false): void
94 94
     {
95
-        if ($overwrite === false && isset($this->buckets[$name])) {
95
+        if ($overwrite === false && isset($this->buckets[$name])){
96 96
             throw new \InvalidArgumentException(\sprintf(self::ERROR_REDEFINITION, $name));
97 97
         }
98 98
 
@@ -125,22 +125,22 @@  discard block
 block discarded – undo
125 125
         $uri = $this->uriToString($uri);
126 126
         $result = \parse_url($uri);
127 127
 
128
-        if ($result === false) {
128
+        if ($result === false){
129 129
             $message = 'URI argument must be a valid URI in "[STORAGE]://[PATH_TO_FILE]" format, but `%s` given';
130 130
             throw new InvalidArgumentException(\sprintf($message, $uri));
131 131
         }
132 132
 
133
-        if (!isset($result['scheme'])) {
133
+        if (!isset($result['scheme'])){
134 134
             $result['scheme'] = $withScheme ? $this->default : null;
135 135
         }
136 136
 
137
-        if (!isset($result['host'])) {
137
+        if (!isset($result['host'])){
138 138
             $result['host'] = '';
139 139
         }
140 140
 
141 141
         return [
142 142
             $result['scheme'] ?? null,
143
-            $result['host'] . \rtrim($result['path'] ?? '', '/'),
143
+            $result['host'].\rtrim($result['path'] ?? '', '/'),
144 144
         ];
145 145
     }
146 146
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      */
151 151
     private function uriToString($uri): string
152 152
     {
153
-        switch (true) {
153
+        switch (true){
154 154
             case $uri instanceof UriInterface:
155 155
             case $uri instanceof \Stringable:
156 156
             case \is_object($uri) && \method_exists($uri, '__toString'):
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -70,7 +70,8 @@  discard block
 block discarded – undo
70 70
     {
71 71
         $name ??= $this->default;
72 72
 
73
-        if (!isset($this->buckets[$name])) {
73
+        if (!isset($this->buckets[$name]))
74
+        {
74 75
             throw new InvalidArgumentException(\sprintf(self::ERROR_NOT_FOUND, $name));
75 76
         }
76 77
 
@@ -92,7 +93,8 @@  discard block
 block discarded – undo
92 93
      */
93 94
     public function add(string $name, BucketInterface $storage, bool $overwrite = false): void
94 95
     {
95
-        if ($overwrite === false && isset($this->buckets[$name])) {
96
+        if ($overwrite === false && isset($this->buckets[$name]))
97
+        {
96 98
             throw new \InvalidArgumentException(\sprintf(self::ERROR_REDEFINITION, $name));
97 99
         }
98 100
 
@@ -125,16 +127,19 @@  discard block
 block discarded – undo
125 127
         $uri = $this->uriToString($uri);
126 128
         $result = \parse_url($uri);
127 129
 
128
-        if ($result === false) {
130
+        if ($result === false)
131
+        {
129 132
             $message = 'URI argument must be a valid URI in "[STORAGE]://[PATH_TO_FILE]" format, but `%s` given';
130 133
             throw new InvalidArgumentException(\sprintf($message, $uri));
131 134
         }
132 135
 
133
-        if (!isset($result['scheme'])) {
136
+        if (!isset($result['scheme']))
137
+        {
134 138
             $result['scheme'] = $withScheme ? $this->default : null;
135 139
         }
136 140
 
137
-        if (!isset($result['host'])) {
141
+        if (!isset($result['host']))
142
+        {
138 143
             $result['host'] = '';
139 144
         }
140 145
 
@@ -150,7 +155,8 @@  discard block
 block discarded – undo
150 155
      */
151 156
     private function uriToString($uri): string
152 157
     {
153
-        switch (true) {
158
+        switch (true)
159
+        {
154 160
             case $uri instanceof UriInterface:
155 161
             case $uri instanceof \Stringable:
156 162
             case \is_object($uri) && \method_exists($uri, '__toString'):
Please login to merge, or discard this patch.
src/Translator/src/Translator.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         TranslatorConfig $config,
37 37
         CatalogueManagerInterface $catalogueManager,
38 38
         IdentityTranslator $identityTranslator = null
39
-    ) {
39
+    ){
40 40
         $this->config = $config;
41 41
         $this->identityTranslator = $identityTranslator ?? new IdentityTranslator();
42 42
         $this->catalogueManager = $catalogueManager;
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      */
61 61
     public function setLocale(string $locale): void
62 62
     {
63
-        if (!$this->catalogueManager->has($locale)) {
63
+        if (!$this->catalogueManager->has($locale)){
64 64
             throw new LocaleException($locale);
65 65
         }
66 66
 
@@ -116,11 +116,11 @@  discard block
 block discarded – undo
116 116
         array $parameters = [],
117 117
         $domain = null,
118 118
         $locale = null
119
-    ) {
119
+    ){
120 120
         $domain ??= $this->config->getDefaultDomain();
121 121
         $locale ??= $this->locale;
122 122
 
123
-        try {
123
+        try{
124 124
             $message = $this->get($locale, $domain, $id);
125 125
 
126 126
             $pluralized = $this->identityTranslator->trans(
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
                 null,
130 130
                 $locale
131 131
             );
132
-        } catch (\InvalidArgumentException $e) {
132
+        }catch (\InvalidArgumentException $e){
133 133
             //Wrapping into more explanatory exception
134 134
             throw new PluralizationException($e->getMessage(), $e->getCode(), $e);
135 135
         }
136 136
 
137
-        if (empty($parameters['n']) && is_numeric($number)) {
137
+        if (empty($parameters['n']) && is_numeric($number)){
138 138
             $parameters['n'] = $number;
139 139
         }
140 140
 
@@ -159,18 +159,18 @@  discard block
 block discarded – undo
159 159
         string $postfix = '}'
160 160
     ): string {
161 161
         $replaces = [];
162
-        foreach ($values as $key => $value) {
162
+        foreach ($values as $key => $value){
163 163
             $value = (is_array($value) || $value instanceof \Closure) ? '' : $value;
164 164
 
165
-            if (is_object($value)) {
166
-                if (method_exists($value, '__toString')) {
165
+            if (is_object($value)){
166
+                if (method_exists($value, '__toString')){
167 167
                     $value = $value->__toString();
168
-                } else {
168
+                }else{
169 169
                     $value = '';
170 170
                 }
171 171
             }
172 172
 
173
-            $replaces[$prefix . $key . $postfix] = $value;
173
+            $replaces[$prefix.$key.$postfix] = $value;
174 174
         }
175 175
 
176 176
         return strtr($string, $replaces);
@@ -190,18 +190,18 @@  discard block
 block discarded – undo
190 190
      */
191 191
     protected function get(string &$locale, string $domain, string $string): string
192 192
     {
193
-        if ($this->catalogueManager->get($locale)->has($domain, $string)) {
193
+        if ($this->catalogueManager->get($locale)->has($domain, $string)){
194 194
             return $this->catalogueManager->get($locale)->get($domain, $string);
195 195
         }
196 196
 
197 197
         $locale = $this->config->getFallbackLocale();
198 198
 
199
-        if ($this->catalogueManager->get($locale)->has($domain, $string)) {
199
+        if ($this->catalogueManager->get($locale)->has($domain, $string)){
200 200
             return $this->catalogueManager->get($locale)->get($domain, $string);
201 201
         }
202 202
 
203 203
         // we can automatically register message
204
-        if ($this->config->isAutoRegisterMessages()) {
204
+        if ($this->config->isAutoRegisterMessages()){
205 205
             $this->catalogueManager->get($locale)->set($domain, $string, $string);
206 206
             $this->catalogueManager->save($locale);
207 207
         }
Please login to merge, or discard this patch.
Braces   +24 added lines, -11 removed lines patch added patch discarded remove patch
@@ -60,7 +60,8 @@  discard block
 block discarded – undo
60 60
      */
61 61
     public function setLocale(string $locale): void
62 62
     {
63
-        if (!$this->catalogueManager->has($locale)) {
63
+        if (!$this->catalogueManager->has($locale))
64
+        {
64 65
             throw new LocaleException($locale);
65 66
         }
66 67
 
@@ -120,7 +121,8 @@  discard block
 block discarded – undo
120 121
         $domain ??= $this->config->getDefaultDomain();
121 122
         $locale ??= $this->locale;
122 123
 
123
-        try {
124
+        try
125
+        {
124 126
             $message = $this->get($locale, $domain, $id);
125 127
 
126 128
             $pluralized = $this->identityTranslator->trans(
@@ -129,12 +131,15 @@  discard block
 block discarded – undo
129 131
                 null,
130 132
                 $locale
131 133
             );
132
-        } catch (\InvalidArgumentException $e) {
134
+        }
135
+        catch (\InvalidArgumentException $e)
136
+        {
133 137
             //Wrapping into more explanatory exception
134 138
             throw new PluralizationException($e->getMessage(), $e->getCode(), $e);
135 139
         }
136 140
 
137
-        if (empty($parameters['n']) && is_numeric($number)) {
141
+        if (empty($parameters['n']) && is_numeric($number))
142
+        {
138 143
             $parameters['n'] = $number;
139 144
         }
140 145
 
@@ -159,13 +164,18 @@  discard block
 block discarded – undo
159 164
         string $postfix = '}'
160 165
     ): string {
161 166
         $replaces = [];
162
-        foreach ($values as $key => $value) {
167
+        foreach ($values as $key => $value)
168
+        {
163 169
             $value = (is_array($value) || $value instanceof \Closure) ? '' : $value;
164 170
 
165
-            if (is_object($value)) {
166
-                if (method_exists($value, '__toString')) {
171
+            if (is_object($value))
172
+            {
173
+                if (method_exists($value, '__toString'))
174
+                {
167 175
                     $value = $value->__toString();
168
-                } else {
176
+                }
177
+                else
178
+                {
169 179
                     $value = '';
170 180
                 }
171 181
             }
@@ -190,18 +200,21 @@  discard block
 block discarded – undo
190 200
      */
191 201
     protected function get(string &$locale, string $domain, string $string): string
192 202
     {
193
-        if ($this->catalogueManager->get($locale)->has($domain, $string)) {
203
+        if ($this->catalogueManager->get($locale)->has($domain, $string))
204
+        {
194 205
             return $this->catalogueManager->get($locale)->get($domain, $string);
195 206
         }
196 207
 
197 208
         $locale = $this->config->getFallbackLocale();
198 209
 
199
-        if ($this->catalogueManager->get($locale)->has($domain, $string)) {
210
+        if ($this->catalogueManager->get($locale)->has($domain, $string))
211
+        {
200 212
             return $this->catalogueManager->get($locale)->get($domain, $string);
201 213
         }
202 214
 
203 215
         // we can automatically register message
204
-        if ($this->config->isAutoRegisterMessages()) {
216
+        if ($this->config->isAutoRegisterMessages())
217
+        {
205 218
             $this->catalogueManager->get($locale)->set($domain, $string, $string);
206 219
             $this->catalogueManager->save($locale);
207 220
         }
Please login to merge, or discard this patch.
src/Dumper/src/helpers.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 use Spiral\Debug\Dumper;
14 14
 
15
-if (!function_exists('dump')) {
15
+if (!function_exists('dump')){
16 16
     /**
17 17
      * Dump value.
18 18
      *
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
      */
24 24
     function dump($value, int $output = Dumper::OUTPUT): ?string
25 25
     {
26
-        if (!class_exists(ContainerScope::class)) {
26
+        if (!class_exists(ContainerScope::class)){
27 27
             return (new Dumper())->dump($value, $output);
28 28
         }
29 29
 
30 30
         $container = ContainerScope::getContainer();
31
-        if (is_null($container) || !$container->has(Dumper::class)) {
31
+        if (is_null($container) || !$container->has(Dumper::class)){
32 32
             $dumper = new Dumper();
33 33
 
34 34
             return $dumper->dump($value, $output);
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,8 @@  discard block
 block discarded – undo
12 12
 
13 13
 use Spiral\Debug\Dumper;
14 14
 
15
-if (!function_exists('dump')) {
15
+if (!function_exists('dump'))
16
+{
16 17
     /**
17 18
      * Dump value.
18 19
      *
@@ -23,12 +24,14 @@  discard block
 block discarded – undo
23 24
      */
24 25
     function dump($value, int $output = Dumper::OUTPUT): ?string
25 26
     {
26
-        if (!class_exists(ContainerScope::class)) {
27
+        if (!class_exists(ContainerScope::class))
28
+        {
27 29
             return (new Dumper())->dump($value, $output);
28 30
         }
29 31
 
30 32
         $container = ContainerScope::getContainer();
31
-        if (is_null($container) || !$container->has(Dumper::class)) {
33
+        if (is_null($container) || !$container->has(Dumper::class))
34
+        {
32 35
             $dumper = new Dumper();
33 36
 
34 37
             return $dumper->dump($value, $output);
Please login to merge, or discard this patch.