Passed
Push — master ( 77392d...e0a3bd )
by Kirill
08:16 queued 11s
created
src/Boot/src/BootloadManager.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -77,21 +77,21 @@  discard block
 block discarded – undo
77 77
      */
78 78
     protected function boot(array $classes): void
79 79
     {
80
-        foreach ($classes as $class => $options) {
80
+        foreach ($classes as $class => $options){
81 81
             // default bootload syntax as simple array
82
-            if (is_string($options)) {
82
+            if (is_string($options)){
83 83
                 $class = $options;
84 84
                 $options = [];
85 85
             }
86 86
 
87
-            if (in_array($class, $this->classes)) {
87
+            if (in_array($class, $this->classes)){
88 88
                 continue;
89 89
             }
90 90
 
91 91
             $this->classes[] = $class;
92 92
             $bootloader = $this->container->get($class);
93 93
 
94
-            if (!$bootloader instanceof BootloaderInterface) {
94
+            if (!$bootloader instanceof BootloaderInterface){
95 95
                 continue;
96 96
             }
97 97
 
@@ -107,17 +107,17 @@  discard block
 block discarded – undo
107 107
      */
108 108
     protected function initBootloader(BootloaderInterface $bootloader, array $options = []): void
109 109
     {
110
-        if ($bootloader instanceof DependedInterface) {
110
+        if ($bootloader instanceof DependedInterface){
111 111
             $this->boot($bootloader->defineDependencies());
112 112
         }
113 113
 
114 114
         $this->initBindings($bootloader->defineBindings(), $bootloader->defineSingletons());
115 115
 
116
-        if ((new \ReflectionClass($bootloader))->hasMethod('boot')) {
116
+        if ((new \ReflectionClass($bootloader))->hasMethod('boot')){
117 117
             $boot = new \ReflectionMethod($bootloader, 'boot');
118 118
 
119 119
             $args = $this->container->resolveArguments($boot, $options);
120
-            if (!isset($args['boot'])) {
120
+            if (!isset($args['boot'])){
121 121
                 $args['boot'] = $options;
122 122
             }
123 123
 
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
      */
134 134
     protected function initBindings(array $bindings, array $singletons): void
135 135
     {
136
-        foreach ($bindings as $aliases => $resolver) {
136
+        foreach ($bindings as $aliases => $resolver){
137 137
             $this->container->bind($aliases, $resolver);
138 138
         }
139 139
 
140
-        foreach ($singletons as $aliases => $resolver) {
140
+        foreach ($singletons as $aliases => $resolver){
141 141
             $this->container->bindSingleton($aliases, $resolver);
142 142
         }
143 143
     }
Please login to merge, or discard this patch.
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -77,21 +77,25 @@  discard block
 block discarded – undo
77 77
      */
78 78
     protected function boot(array $classes): void
79 79
     {
80
-        foreach ($classes as $class => $options) {
80
+        foreach ($classes as $class => $options)
81
+        {
81 82
             // default bootload syntax as simple array
82
-            if (is_string($options)) {
83
+            if (is_string($options))
84
+            {
83 85
                 $class = $options;
84 86
                 $options = [];
85 87
             }
86 88
 
87
-            if (in_array($class, $this->classes)) {
89
+            if (in_array($class, $this->classes))
90
+            {
88 91
                 continue;
89 92
             }
90 93
 
91 94
             $this->classes[] = $class;
92 95
             $bootloader = $this->container->get($class);
93 96
 
94
-            if (!$bootloader instanceof BootloaderInterface) {
97
+            if (!$bootloader instanceof BootloaderInterface)
98
+            {
95 99
                 continue;
96 100
             }
97 101
 
@@ -107,17 +111,20 @@  discard block
 block discarded – undo
107 111
      */
108 112
     protected function initBootloader(BootloaderInterface $bootloader, array $options = []): void
109 113
     {
110
-        if ($bootloader instanceof DependedInterface) {
114
+        if ($bootloader instanceof DependedInterface)
115
+        {
111 116
             $this->boot($bootloader->defineDependencies());
112 117
         }
113 118
 
114 119
         $this->initBindings($bootloader->defineBindings(), $bootloader->defineSingletons());
115 120
 
116
-        if ((new \ReflectionClass($bootloader))->hasMethod('boot')) {
121
+        if ((new \ReflectionClass($bootloader))->hasMethod('boot'))
122
+        {
117 123
             $boot = new \ReflectionMethod($bootloader, 'boot');
118 124
 
119 125
             $args = $this->container->resolveArguments($boot, $options);
120
-            if (!isset($args['boot'])) {
126
+            if (!isset($args['boot']))
127
+            {
121 128
                 $args['boot'] = $options;
122 129
             }
123 130
 
@@ -133,11 +140,13 @@  discard block
 block discarded – undo
133 140
      */
134 141
     protected function initBindings(array $bindings, array $singletons): void
135 142
     {
136
-        foreach ($bindings as $aliases => $resolver) {
143
+        foreach ($bindings as $aliases => $resolver)
144
+        {
137 145
             $this->container->bind($aliases, $resolver);
138 146
         }
139 147
 
140
-        foreach ($singletons as $aliases => $resolver) {
148
+        foreach ($singletons as $aliases => $resolver)
149
+        {
141 150
             $this->container->bindSingleton($aliases, $resolver);
142 151
         }
143 152
     }
Please login to merge, or discard this patch.
src/Boot/src/Environment.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function getID(): string
44 44
     {
45
-        if (empty($this->id)) {
45
+        if (empty($this->id)){
46 46
             $this->id = md5(serialize($this->values));
47 47
         }
48 48
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public function get(string $name, $default = null)
67 67
     {
68
-        if (isset($this->values[$name])) {
68
+        if (isset($this->values[$name])){
69 69
             return $this->normalize($this->values[$name]);
70 70
         }
71 71
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     {
82 82
         $result = [];
83 83
 
84
-        foreach ($this->values as $key => $value) {
84
+        foreach ($this->values as $key => $value){
85 85
             $result[$key] = $this->normalize($value);
86 86
         }
87 87
 
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
      */
95 95
     protected function normalize($value)
96 96
     {
97
-        if (!is_string($value)) {
97
+        if (!is_string($value)){
98 98
             return $value;
99 99
         }
100 100
 
101 101
         $alias = strtolower($value);
102
-        if (isset(self::VALUE_MAP[$alias])) {
102
+        if (isset(self::VALUE_MAP[$alias])){
103 103
             return self::VALUE_MAP[$alias];
104 104
         }
105 105
 
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -42,7 +42,8 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function getID(): string
44 44
     {
45
-        if (empty($this->id)) {
45
+        if (empty($this->id))
46
+        {
46 47
             $this->id = md5(serialize($this->values));
47 48
         }
48 49
 
@@ -65,7 +66,8 @@  discard block
 block discarded – undo
65 66
      */
66 67
     public function get(string $name, $default = null)
67 68
     {
68
-        if (isset($this->values[$name])) {
69
+        if (isset($this->values[$name]))
70
+        {
69 71
             return $this->normalize($this->values[$name]);
70 72
         }
71 73
 
@@ -81,7 +83,8 @@  discard block
 block discarded – undo
81 83
     {
82 84
         $result = [];
83 85
 
84
-        foreach ($this->values as $key => $value) {
86
+        foreach ($this->values as $key => $value)
87
+        {
85 88
             $result[$key] = $this->normalize($value);
86 89
         }
87 90
 
@@ -94,12 +97,14 @@  discard block
 block discarded – undo
94 97
      */
95 98
     protected function normalize($value)
96 99
     {
97
-        if (!is_string($value)) {
100
+        if (!is_string($value))
101
+        {
98 102
             return $value;
99 103
         }
100 104
 
101 105
         $alias = strtolower($value);
102
-        if (isset(self::VALUE_MAP[$alias])) {
106
+        if (isset(self::VALUE_MAP[$alias]))
107
+        {
103 108
             return self::VALUE_MAP[$alias];
104 109
         }
105 110
 
Please login to merge, or discard this patch.
src/Boot/src/Finalizer.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
      */
30 30
     public function finalize(bool $terminate = false): void
31 31
     {
32
-        foreach ($this->finalizers as $finalizer) {
32
+        foreach ($this->finalizers as $finalizer){
33 33
             call_user_func($finalizer, $terminate);
34 34
         }
35 35
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,8 @@
 block discarded – undo
29 29
      */
30 30
     public function finalize(bool $terminate = false): void
31 31
     {
32
-        foreach ($this->finalizers as $finalizer) {
32
+        foreach ($this->finalizers as $finalizer)
33
+        {
33 34
             call_user_func($finalizer, $terminate);
34 35
         }
35 36
     }
Please login to merge, or discard this patch.
src/Boot/src/Directories.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public function __construct(array $directories)
25 25
     {
26
-        foreach ($directories as $name => $directory) {
26
+        foreach ($directories as $name => $directory){
27 27
             $this->set($name, $directory);
28 28
         }
29 29
     }
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     public function set(string $name, string $path): DirectoriesInterface
43 43
     {
44 44
         $path = str_replace(['\\', '//'], '/', $path);
45
-        $this->directories[$name] = rtrim($path, '/') . '/';
45
+        $this->directories[$name] = rtrim($path, '/').'/';
46 46
 
47 47
         return $this;
48 48
     }
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      */
53 53
     public function get(string $name): string
54 54
     {
55
-        if (!$this->has($name)) {
55
+        if (!$this->has($name)){
56 56
             throw new DirectoryException("Undefined directory '{$name}'");
57 57
         }
58 58
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,8 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public function __construct(array $directories)
25 25
     {
26
-        foreach ($directories as $name => $directory) {
26
+        foreach ($directories as $name => $directory)
27
+        {
27 28
             $this->set($name, $directory);
28 29
         }
29 30
     }
@@ -52,7 +53,8 @@  discard block
 block discarded – undo
52 53
      */
53 54
     public function get(string $name): string
54 55
     {
55
-        if (!$this->has($name)) {
56
+        if (!$this->has($name))
57
+        {
56 58
             throw new DirectoryException("Undefined directory '{$name}'");
57 59
         }
58 60
 
Please login to merge, or discard this patch.
src/Boot/src/Memory.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
     {
45 45
         $filename = $this->getFilename($section);
46 46
 
47
-        if (!file_exists($filename)) {
47
+        if (!file_exists($filename)){
48 48
             return null;
49 49
         }
50 50
 
51
-        try {
51
+        try{
52 52
             return include($filename);
53
-        } catch (\Throwable $e) {
53
+        }catch (\Throwable $e){
54 54
             return null;
55 55
         }
56 56
     }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     {
63 63
         $this->files->write(
64 64
             $this->getFilename($section),
65
-            '<?php return ' . var_export($data, true) . ';',
65
+            '<?php return '.var_export($data, true).';',
66 66
             FilesInterface::RUNTIME,
67 67
             true
68 68
         );
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,13 +44,17 @@
 block discarded – undo
44 44
     {
45 45
         $filename = $this->getFilename($section);
46 46
 
47
-        if (!file_exists($filename)) {
47
+        if (!file_exists($filename))
48
+        {
48 49
             return null;
49 50
         }
50 51
 
51
-        try {
52
+        try
53
+        {
52 54
             return include($filename);
53
-        } catch (\Throwable $e) {
55
+        }
56
+        catch (\Throwable $e)
57
+        {
54 58
             return null;
55 59
         }
56 60
     }
Please login to merge, or discard this patch.
src/Boot/src/helpers.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 use Spiral\Core\ContainerScope;
17 17
 use Spiral\Core\Exception\ScopeException;
18 18
 
19
-if (!function_exists('spiral')) {
19
+if (!function_exists('spiral')){
20 20
     /**
21 21
      * Resolve given alias in current IoC scope.
22 22
      *
@@ -27,19 +27,19 @@  discard block
 block discarded – undo
27 27
      */
28 28
     function spiral(string $alias)
29 29
     {
30
-        if (ContainerScope::getContainer() === null) {
30
+        if (ContainerScope::getContainer() === null){
31 31
             throw new ScopeException('Container scope was not set.');
32 32
         }
33 33
 
34
-        try {
34
+        try{
35 35
             return ContainerScope::getContainer()->get($alias);
36
-        } catch (ContainerExceptionInterface $e) {
36
+        }catch (ContainerExceptionInterface $e){
37 37
             throw new ScopeException($e->getMessage(), $e->getCode(), $e);
38 38
         }
39 39
     }
40 40
 }
41 41
 
42
-if (!function_exists('directory')) {
42
+if (!function_exists('directory')){
43 43
     /**
44 44
      * Get directory alias value. Uses application core from the current global scope.
45 45
      *
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     }
56 56
 }
57 57
 
58
-if (!function_exists('env')) {
58
+if (!function_exists('env')){
59 59
     /**
60 60
      * Gets the value of an environment variable. Uses application core from the current global scope.
61 61
      *
Please login to merge, or discard this patch.
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -16,7 +16,8 @@  discard block
 block discarded – undo
16 16
 use Spiral\Core\ContainerScope;
17 17
 use Spiral\Core\Exception\ScopeException;
18 18
 
19
-if (!function_exists('spiral')) {
19
+if (!function_exists('spiral'))
20
+{
20 21
     /**
21 22
      * Resolve given alias in current IoC scope.
22 23
      *
@@ -27,19 +28,24 @@  discard block
 block discarded – undo
27 28
      */
28 29
     function spiral(string $alias)
29 30
     {
30
-        if (ContainerScope::getContainer() === null) {
31
+        if (ContainerScope::getContainer() === null)
32
+        {
31 33
             throw new ScopeException('Container scope was not set.');
32 34
         }
33 35
 
34
-        try {
36
+        try
37
+        {
35 38
             return ContainerScope::getContainer()->get($alias);
36
-        } catch (ContainerExceptionInterface $e) {
39
+        }
40
+        catch (ContainerExceptionInterface $e)
41
+        {
37 42
             throw new ScopeException($e->getMessage(), $e->getCode(), $e);
38 43
         }
39 44
     }
40 45
 }
41 46
 
42
-if (!function_exists('directory')) {
47
+if (!function_exists('directory'))
48
+{
43 49
     /**
44 50
      * Get directory alias value. Uses application core from the current global scope.
45 51
      *
@@ -55,7 +61,8 @@  discard block
 block discarded – undo
55 61
     }
56 62
 }
57 63
 
58
-if (!function_exists('env')) {
64
+if (!function_exists('env'))
65
+{
59 66
     /**
60 67
      * Gets the value of an environment variable. Uses application core from the current global scope.
61 68
      *
Please login to merge, or discard this patch.
src/Boot/src/AbstractKernel.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
      */
98 98
     public function serve()
99 99
     {
100
-        foreach ($this->dispatchers as $dispatcher) {
101
-            if ($dispatcher->canServe()) {
100
+        foreach ($this->dispatchers as $dispatcher){
101
+            if ($dispatcher->canServe()){
102 102
                 return $this->container->runScope(
103 103
                     [DispatcherInterface::class => $dispatcher],
104 104
                     [$dispatcher, 'serve']
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         EnvironmentInterface $environment = null,
125 125
         bool $handleErrors = true
126 126
     ): ?self {
127
-        if ($handleErrors) {
127
+        if ($handleErrors){
128 128
             ExceptionHandler::register();
129 129
         }
130 130
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         $core = new static(new Container(), $directories);
134 134
         $core->container->bindSingleton(EnvironmentInterface::class, $environment);
135 135
 
136
-        try {
136
+        try{
137 137
             // will protect any against env overwrite action
138 138
             $core->container->runScope(
139 139
                 [EnvironmentInterface::class => $environment],
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
                     $core->bootstrap();
143 143
                 }
144 144
             );
145
-        } catch (\Throwable $e) {
145
+        }catch (\Throwable $e){
146 146
             ExceptionHandler::handleException($e);
147 147
 
148 148
             return null;
Please login to merge, or discard this patch.
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -97,8 +97,10 @@  discard block
 block discarded – undo
97 97
      */
98 98
     public function serve()
99 99
     {
100
-        foreach ($this->dispatchers as $dispatcher) {
101
-            if ($dispatcher->canServe()) {
100
+        foreach ($this->dispatchers as $dispatcher)
101
+        {
102
+            if ($dispatcher->canServe())
103
+            {
102 104
                 return $this->container->runScope(
103 105
                     [DispatcherInterface::class => $dispatcher],
104 106
                     [$dispatcher, 'serve']
@@ -124,7 +126,8 @@  discard block
 block discarded – undo
124 126
         EnvironmentInterface $environment = null,
125 127
         bool $handleErrors = true
126 128
     ): ?self {
127
-        if ($handleErrors) {
129
+        if ($handleErrors)
130
+        {
128 131
             ExceptionHandler::register();
129 132
         }
130 133
 
@@ -133,7 +136,8 @@  discard block
 block discarded – undo
133 136
         $core = new static(new Container(), $directories);
134 137
         $core->container->bindSingleton(EnvironmentInterface::class, $environment);
135 138
 
136
-        try {
139
+        try
140
+        {
137 141
             // will protect any against env overwrite action
138 142
             $core->container->runScope(
139 143
                 [EnvironmentInterface::class => $environment],
@@ -142,7 +146,9 @@  discard block
 block discarded – undo
142 146
                     $core->bootstrap();
143 147
                 }
144 148
             );
145
-        } catch (\Throwable $e) {
149
+        }
150
+        catch (\Throwable $e)
151
+        {
146 152
             ExceptionHandler::handleException($e);
147 153
 
148 154
             return null;
Please login to merge, or discard this patch.
src/Exceptions/tests/HighlighterTest.php 1 patch
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
     public function testHtmlHighlighter(): void
30 30
     {
31
-        $highlighter = new Highlighter(new HtmlStyle(HtmlStyle::DEFAULT));
31
+        $highlighter = new Highlighter(new HtmlStyle(HtmlStyle::default));
32 32
 
33 33
         $this->assertStringContainsString('HighlighterTest', $highlighter->highlight(file_get_contents(__FILE__)));
34 34
     }
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
     public function testHtmlHighlighterLines(): void
61 61
     {
62
-        $highlighter = new Highlighter(new HtmlStyle(HtmlStyle::DEFAULT));
62
+        $highlighter = new Highlighter(new HtmlStyle(HtmlStyle::default));
63 63
 
64 64
         $this->assertStringContainsString(
65 65
             'HighlighterTest',
Please login to merge, or discard this patch.
src/Exceptions/views/exception.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
         </div>
48 48
     </div>
49 49
     <?php
50
-    foreach ($valueWrapper->getValues() as $id => $content) {
50
+    foreach ($valueWrapper->getValues() as $id => $content){
51 51
         echo "<div id=\"argument-{$id}\" style=\"display: none\">{$content}</div>";
52 52
     }
53 53
     ?>
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,8 @@
 block discarded – undo
47 47
         </div>
48 48
     </div>
49 49
     <?php
50
-    foreach ($valueWrapper->getValues() as $id => $content) {
50
+    foreach ($valueWrapper->getValues() as $id => $content)
51
+    {
51 52
         echo "<div id=\"argument-{$id}\" style=\"display: none\">{$content}</div>";
52 53
     }
53 54
     ?>
Please login to merge, or discard this patch.