Passed
Push — master ( d96454...56489c )
by Kirill
06:17 queued 12s
created
src/Framework/Session/Middleware/SessionMiddleware.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         CookiesConfig $cookiesConfig,
61 61
         SessionFactory $factory,
62 62
         ScopeInterface $scope
63
-    ) {
63
+    ){
64 64
         $this->config = $config;
65 65
         $this->httpConfig = $httpConfig;
66 66
         $this->cookiesConfig = $cookiesConfig;
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
             $this->fetchID($request)
80 80
         );
81 81
 
82
-        try {
82
+        try{
83 83
             $response = $this->scope->runScope(
84 84
                 [SessionInterface::class => $session],
85 85
                 function () use ($handler, $request, $session) {
86 86
                     return $handler->handle($request->withAttribute(static::ATTRIBUTE, $session));
87 87
                 }
88 88
             );
89
-        } catch (\Throwable $e) {
89
+        }catch (\Throwable $e){
90 90
             $session->abort();
91 91
             throw $e;
92 92
         }
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
         Request $request,
106 106
         Response $response
107 107
     ): Response {
108
-        if (!$session->isStarted()) {
108
+        if (!$session->isStarted()){
109 109
             return $response;
110 110
         }
111 111
 
112 112
         $session->commit();
113 113
 
114 114
         //SID changed
115
-        if ($this->fetchID($request) != $session->getID()) {
115
+        if ($this->fetchID($request) != $session->getID()){
116 116
             return $this->withCookie($request, $response, $session->getID());
117 117
         }
118 118
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
     protected function fetchID(Request $request): ?string
130 130
     {
131 131
         $cookies = $request->getCookieParams();
132
-        if (empty($cookies[$this->config->getCookie()])) {
132
+        if (empty($cookies[$this->config->getCookie()])){
133 133
             return null;
134 134
         }
135 135
 
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
     protected function clientSignature(Request $request): string
163 163
     {
164 164
         $signature = '';
165
-        foreach (static::SIGNATURE_HEADERS as $header) {
166
-            $signature .= $request->getHeaderLine($header) . ';';
165
+        foreach (static::SIGNATURE_HEADERS as $header){
166
+            $signature .= $request->getHeaderLine($header).';';
167 167
         }
168 168
 
169 169
         return hash('sha256', $signature);
Please login to merge, or discard this patch.
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -79,14 +79,18 @@  discard block
 block discarded – undo
79 79
             $this->fetchID($request)
80 80
         );
81 81
 
82
-        try {
82
+        try
83
+        {
83 84
             $response = $this->scope->runScope(
84 85
                 [SessionInterface::class => $session],
85
-                function () use ($handler, $request, $session) {
86
+                function () use ($handler, $request, $session)
87
+                {
86 88
                     return $handler->handle($request->withAttribute(static::ATTRIBUTE, $session));
87 89
                 }
88 90
             );
89
-        } catch (\Throwable $e) {
91
+        }
92
+        catch (\Throwable $e)
93
+        {
90 94
             $session->abort();
91 95
             throw $e;
92 96
         }
@@ -105,14 +109,16 @@  discard block
 block discarded – undo
105 109
         Request $request,
106 110
         Response $response
107 111
     ): Response {
108
-        if (!$session->isStarted()) {
112
+        if (!$session->isStarted())
113
+        {
109 114
             return $response;
110 115
         }
111 116
 
112 117
         $session->commit();
113 118
 
114 119
         //SID changed
115
-        if ($this->fetchID($request) != $session->getID()) {
120
+        if ($this->fetchID($request) != $session->getID())
121
+        {
116 122
             return $this->withCookie($request, $response, $session->getID());
117 123
         }
118 124
 
@@ -129,7 +135,8 @@  discard block
 block discarded – undo
129 135
     protected function fetchID(Request $request): ?string
130 136
     {
131 137
         $cookies = $request->getCookieParams();
132
-        if (empty($cookies[$this->config->getCookie()])) {
138
+        if (empty($cookies[$this->config->getCookie()]))
139
+        {
133 140
             return null;
134 141
         }
135 142
 
@@ -162,7 +169,8 @@  discard block
 block discarded – undo
162 169
     protected function clientSignature(Request $request): string
163 170
     {
164 171
         $signature = '';
165
-        foreach (static::SIGNATURE_HEADERS as $header) {
172
+        foreach (static::SIGNATURE_HEADERS as $header)
173
+        {
166 174
             $signature .= $request->getHeaderLine($header) . ';';
167 175
         }
168 176
 
Please login to merge, or discard this patch.
src/Framework/Snapshots/FileSnapshooter.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         HandlerInterface $handler,
54 54
         FilesInterface $files,
55 55
         LoggerInterface $logger = null
56
-    ) {
56
+    ){
57 57
         $this->directory = $directory;
58 58
         $this->maxFiles = $maxFiles;
59 59
         $this->verbosity = $verbosity;
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     {
70 70
         $snapshot = new Snapshot($this->getID($e), $e);
71 71
 
72
-        if ($this->logger !== null) {
72
+        if ($this->logger !== null){
73 73
             $this->logger->error($snapshot->getMessage());
74 74
         }
75 75
 
@@ -102,18 +102,18 @@  discard block
 block discarded – undo
102 102
     {
103 103
         $finder = new Finder();
104 104
         $finder->in($this->directory)->sort(
105
-            static function (SplFileInfo $a, SplFileInfo $b) {
105
+            static function (SplFileInfo $a, SplFileInfo $b){
106 106
                 return $b->getMTime() - $a->getMTime();
107 107
             }
108 108
         );
109 109
 
110 110
         $count = 0;
111
-        foreach ($finder as $file) {
111
+        foreach ($finder as $file){
112 112
             $count++;
113
-            if ($count > $this->maxFiles) {
114
-                try {
113
+            if ($count > $this->maxFiles){
114
+                try{
115 115
                     $this->files->delete($file->getRealPath());
116
-                } catch (FilesException $e) {
116
+                }catch (FilesException $e){
117 117
                     // ignore
118 118
                 }
119 119
             }
Please login to merge, or discard this patch.
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -69,7 +69,8 @@  discard block
 block discarded – undo
69 69
     {
70 70
         $snapshot = new Snapshot($this->getID($e), $e);
71 71
 
72
-        if ($this->logger !== null) {
72
+        if ($this->logger !== null)
73
+        {
73 74
             $this->logger->error($snapshot->getMessage());
74 75
         }
75 76
 
@@ -102,18 +103,24 @@  discard block
 block discarded – undo
102 103
     {
103 104
         $finder = new Finder();
104 105
         $finder->in($this->directory)->sort(
105
-            static function (SplFileInfo $a, SplFileInfo $b) {
106
+            static function (SplFileInfo $a, SplFileInfo $b)
107
+            {
106 108
                 return $b->getMTime() - $a->getMTime();
107 109
             }
108 110
         );
109 111
 
110 112
         $count = 0;
111
-        foreach ($finder as $file) {
113
+        foreach ($finder as $file)
114
+        {
112 115
             $count++;
113
-            if ($count > $this->maxFiles) {
114
-                try {
116
+            if ($count > $this->maxFiles)
117
+            {
118
+                try
119
+                {
115 120
                     $this->files->delete($file->getRealPath());
116
-                } catch (FilesException $e) {
121
+                }
122
+                catch (FilesException $e)
123
+                {
117 124
                     // ignore
118 125
                 }
119 126
             }
Please login to merge, or discard this patch.
src/Framework/Debug/StateCollector/HttpCollector.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public function populate(StateInterface $state): void
41 41
     {
42
-        if ($this->request === null) {
42
+        if ($this->request === null){
43 43
             return;
44 44
         }
45 45
 
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
 
49 49
         $state->setVariable('headers', $this->request->getHeaders());
50 50
 
51
-        if ($this->request->getQueryParams() !== []) {
51
+        if ($this->request->getQueryParams() !== []){
52 52
             $state->setVariable('query', $this->request->getQueryParams());
53 53
         }
54 54
 
55
-        if ($this->request->getParsedBody() !== null) {
55
+        if ($this->request->getParsedBody() !== null){
56 56
             $state->setVariable('data', $this->request->getParsedBody());
57 57
         }
58 58
     }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -39,7 +39,8 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public function populate(StateInterface $state): void
41 41
     {
42
-        if ($this->request === null) {
42
+        if ($this->request === null)
43
+        {
43 44
             return;
44 45
         }
45 46
 
@@ -48,11 +49,13 @@  discard block
 block discarded – undo
48 49
 
49 50
         $state->setVariable('headers', $this->request->getHeaders());
50 51
 
51
-        if ($this->request->getQueryParams() !== []) {
52
+        if ($this->request->getQueryParams() !== [])
53
+        {
52 54
             $state->setVariable('query', $this->request->getQueryParams());
53 55
         }
54 56
 
55
-        if ($this->request->getParsedBody() !== null) {
57
+        if ($this->request->getParsedBody() !== null)
58
+        {
56 59
             $state->setVariable('data', $this->request->getParsedBody());
57 60
         }
58 61
     }
Please login to merge, or discard this patch.
src/Framework/Framework/Kernel.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -43,29 +43,29 @@
 block discarded – undo
43 43
      */
44 44
     protected function mapDirectories(array $directories): array
45 45
     {
46
-        if (!isset($directories['root'])) {
46
+        if (!isset($directories['root'])){
47 47
             throw new BootException('Missing required directory `root`');
48 48
         }
49 49
 
50
-        if (!isset($directories['app'])) {
51
-            $directories['app'] = $directories['root'] . '/app/';
50
+        if (!isset($directories['app'])){
51
+            $directories['app'] = $directories['root'].'/app/';
52 52
         }
53 53
 
54 54
         return array_merge(
55 55
             [
56 56
                 // public root
57
-                'public'    => $directories['root'] . '/public/',
57
+                'public'    => $directories['root'].'/public/',
58 58
 
59 59
                 // vendor libraries
60
-                'vendor'    => $directories['root'] . '/vendor/',
60
+                'vendor'    => $directories['root'].'/vendor/',
61 61
 
62 62
                 // data directories
63
-                'runtime'   => $directories['root'] . '/runtime/',
64
-                'cache'     => $directories['root'] . '/runtime/cache/',
63
+                'runtime'   => $directories['root'].'/runtime/',
64
+                'cache'     => $directories['root'].'/runtime/cache/',
65 65
 
66 66
                 // application directories
67
-                'config'    => $directories['app'] . '/config/',
68
-                'resources' => $directories['app'] . '/resources/',
67
+                'config'    => $directories['app'].'/config/',
68
+                'resources' => $directories['app'].'/resources/',
69 69
             ],
70 70
             $directories
71 71
         );
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,11 +43,13 @@
 block discarded – undo
43 43
      */
44 44
     protected function mapDirectories(array $directories): array
45 45
     {
46
-        if (!isset($directories['root'])) {
46
+        if (!isset($directories['root']))
47
+        {
47 48
             throw new BootException('Missing required directory `root`');
48 49
         }
49 50
 
50
-        if (!isset($directories['app'])) {
51
+        if (!isset($directories['app']))
52
+        {
51 53
             $directories['app'] = $directories['root'] . '/app/';
52 54
         }
53 55
 
Please login to merge, or discard this patch.
src/Framework/Cookies/CookieManager.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
      */
175 175
     private function getRequest(): ServerRequestInterface
176 176
     {
177
-        try {
177
+        try{
178 178
             return $this->container->get(ServerRequestInterface::class);
179
-        } catch (NotFoundExceptionInterface $e) {
179
+        }catch (NotFoundExceptionInterface $e){
180 180
             throw new ScopeException('Unable to receive active request', $e->getCode(), $e);
181 181
         }
182 182
     }
@@ -188,9 +188,9 @@  discard block
 block discarded – undo
188 188
      */
189 189
     private function getCookieQueue(): CookieQueue
190 190
     {
191
-        try {
191
+        try{
192 192
             return $this->container->get(CookieQueue::class);
193
-        } catch (NotFoundExceptionInterface $e) {
193
+        }catch (NotFoundExceptionInterface $e){
194 194
             throw new ScopeException('Unable to receive cookie queue, invalid request scope', $e->getCode(), $e);
195 195
         }
196 196
     }
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -169,9 +169,12 @@  discard block
 block discarded – undo
169 169
      */
170 170
     private function getRequest(): ServerRequestInterface
171 171
     {
172
-        try {
172
+        try
173
+        {
173 174
             return $this->container->get(ServerRequestInterface::class);
174
-        } catch (NotFoundExceptionInterface $e) {
175
+        }
176
+        catch (NotFoundExceptionInterface $e)
177
+        {
175 178
             throw new ScopeException('Unable to receive active request', $e->getCode(), $e);
176 179
         }
177 180
     }
@@ -183,9 +186,12 @@  discard block
 block discarded – undo
183 186
      */
184 187
     private function getCookieQueue(): CookieQueue
185 188
     {
186
-        try {
189
+        try
190
+        {
187 191
             return $this->container->get(CookieQueue::class);
188
-        } catch (NotFoundExceptionInterface $e) {
192
+        }
193
+        catch (NotFoundExceptionInterface $e)
194
+        {
189 195
             throw new ScopeException('Unable to receive cookie queue, invalid request scope', $e->getCode(), $e);
190 196
         }
191 197
     }
Please login to merge, or discard this patch.
src/Framework/Bootloader/CommandBootloader.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -78,35 +78,35 @@  discard block
 block discarded – undo
78 78
      */
79 79
     private function configureExtensions(ConsoleBootloader $console, Container $container): void
80 80
     {
81
-        if ($container->has(DatabaseProviderInterface::class)) {
81
+        if ($container->has(DatabaseProviderInterface::class)){
82 82
             $this->configureDatabase($console);
83 83
         }
84 84
 
85
-        if ($container->has(ORMInterface::class)) {
85
+        if ($container->has(ORMInterface::class)){
86 86
             $this->configureCycle($console, $container);
87 87
         }
88 88
 
89
-        if ($container->has(TranslatorInterface::class)) {
89
+        if ($container->has(TranslatorInterface::class)){
90 90
             $this->configureTranslator($console);
91 91
         }
92 92
 
93
-        if ($container->has(ViewsInterface::class)) {
93
+        if ($container->has(ViewsInterface::class)){
94 94
             $this->configureViews($console);
95 95
         }
96 96
 
97
-        if ($container->has(Migrator::class)) {
97
+        if ($container->has(Migrator::class)){
98 98
             $this->configureMigrations($console);
99 99
         }
100 100
 
101
-        if ($container->has(InvokerInterface::class)) {
101
+        if ($container->has(InvokerInterface::class)){
102 102
             $this->configureGRPC($console);
103 103
         }
104 104
 
105
-        if ($container->has(EncryptionInterface::class)) {
105
+        if ($container->has(EncryptionInterface::class)){
106 106
             $this->configureEncrypter($console);
107 107
         }
108 108
 
109
-        if ($container->has(RouterInterface::class)) {
109
+        if ($container->has(RouterInterface::class)){
110 110
             $console->addCommand(Router\ListCommand::class);
111 111
         }
112 112
     }
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 136
         $console->addCommand(Cycle\SyncCommand::class);
137 137
 
138
-        if ($container->has(Migrator::class)) {
138
+        if ($container->has(Migrator::class)){
139 139
             $console->addCommand(Cycle\MigrateCommand::class);
140 140
         }
141 141
     }
Please login to merge, or discard this patch.
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -78,35 +78,43 @@  discard block
 block discarded – undo
78 78
      */
79 79
     private function configureExtensions(ConsoleBootloader $console, Container $container): void
80 80
     {
81
-        if ($container->has(DatabaseProviderInterface::class)) {
81
+        if ($container->has(DatabaseProviderInterface::class))
82
+        {
82 83
             $this->configureDatabase($console);
83 84
         }
84 85
 
85
-        if ($container->has(ORMInterface::class)) {
86
+        if ($container->has(ORMInterface::class))
87
+        {
86 88
             $this->configureCycle($console, $container);
87 89
         }
88 90
 
89
-        if ($container->has(TranslatorInterface::class)) {
91
+        if ($container->has(TranslatorInterface::class))
92
+        {
90 93
             $this->configureTranslator($console);
91 94
         }
92 95
 
93
-        if ($container->has(ViewsInterface::class)) {
96
+        if ($container->has(ViewsInterface::class))
97
+        {
94 98
             $this->configureViews($console);
95 99
         }
96 100
 
97
-        if ($container->has(Migrator::class)) {
101
+        if ($container->has(Migrator::class))
102
+        {
98 103
             $this->configureMigrations($console);
99 104
         }
100 105
 
101
-        if ($container->has(InvokerInterface::class)) {
106
+        if ($container->has(InvokerInterface::class))
107
+        {
102 108
             $this->configureGRPC($console);
103 109
         }
104 110
 
105
-        if ($container->has(EncryptionInterface::class)) {
111
+        if ($container->has(EncryptionInterface::class))
112
+        {
106 113
             $this->configureEncrypter($console);
107 114
         }
108 115
 
109
-        if ($container->has(RouterInterface::class)) {
116
+        if ($container->has(RouterInterface::class))
117
+        {
110 118
             $console->addCommand(Router\ListCommand::class);
111 119
         }
112 120
     }
@@ -135,7 +143,8 @@  discard block
 block discarded – undo
135 143
 
136 144
         $console->addCommand(Cycle\SyncCommand::class);
137 145
 
138
-        if ($container->has(Migrator::class)) {
146
+        if ($container->has(Migrator::class))
147
+        {
139 148
             $console->addCommand(Cycle\MigrateCommand::class);
140 149
         }
141 150
     }
Please login to merge, or discard this patch.
src/Framework/Bootloader/Database/DisconnectsBootloader.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
             function () use ($container): void {
32 32
                 /** @var DatabaseManager $dbal */
33 33
                 $dbal = $container->get(DatabaseManager::class);
34
-                foreach ($dbal->getDrivers() as $driver) {
34
+                foreach ($dbal->getDrivers() as $driver){
35 35
                     $driver->disconnect();
36 36
                 }
37 37
             }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,8 @@
 block discarded – undo
31 31
             function () use ($container): void {
32 32
                 /** @var DatabaseManager $dbal */
33 33
                 $dbal = $container->get(DatabaseManager::class);
34
-                foreach ($dbal->getDrivers() as $driver) {
34
+                foreach ($dbal->getDrivers() as $driver)
35
+                {
35 36
                     $driver->disconnect();
36 37
                 }
37 38
             }
Please login to merge, or discard this patch.
src/Framework/Bootloader/Database/MigrationsBootloader.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,8 +42,8 @@
 block discarded – undo
42 42
         EnvironmentInterface $env,
43 43
         DirectoriesInterface $dirs
44 44
     ): void {
45
-        if (!$dirs->has('migrations')) {
46
-            $dirs->set('migrations', $dirs->get('app') . 'migrations');
45
+        if (!$dirs->has('migrations')){
46
+            $dirs->set('migrations', $dirs->get('app').'migrations');
47 47
         }
48 48
 
49 49
         $config->setDefaults(
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,8 @@
 block discarded – undo
40 40
         EnvironmentInterface $env,
41 41
         DirectoriesInterface $dirs
42 42
     ): void {
43
-        if (!$dirs->has('migrations')) {
43
+        if (!$dirs->has('migrations'))
44
+        {
44 45
             $dirs->set('migrations', $dirs->get('app') . 'migrations');
45 46
         }
46 47
 
Please login to merge, or discard this patch.
src/Framework/Bootloader/Cycle/CycleBootloader.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     {
54 54
         $finalizer->addFinalizer(
55 55
             function () use ($container): void {
56
-                if ($container->hasInstance(ORMInterface::class)) {
56
+                if ($container->hasInstance(ORMInterface::class)){
57 57
                     $container->get(ORMInterface::class)->getHeap()->clean();
58 58
                 }
59 59
             }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     ): ORMInterface {
76 76
         $orm = new ORM($factory, $schema);
77 77
 
78
-        if ($promiseFactory !== null) {
78
+        if ($promiseFactory !== null){
79 79
             return $orm->withPromiseFactory($promiseFactory);
80 80
         }
81 81
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,7 +53,8 @@  discard block
 block discarded – undo
53 53
     {
54 54
         $finalizer->addFinalizer(
55 55
             function () use ($container): void {
56
-                if ($container->hasInstance(ORMInterface::class)) {
56
+                if ($container->hasInstance(ORMInterface::class))
57
+                {
57 58
                     $container->get(ORMInterface::class)->getHeap()->clean();
58 59
                 }
59 60
             }
@@ -75,7 +76,8 @@  discard block
 block discarded – undo
75 76
     ): ORMInterface {
76 77
         $orm = new ORM($factory, $schema);
77 78
 
78
-        if ($promiseFactory !== null) {
79
+        if ($promiseFactory !== null)
80
+        {
79 81
             return $orm->withPromiseFactory($promiseFactory);
80 82
         }
81 83
 
Please login to merge, or discard this patch.