Passed
Push — master ( beb5fc...4d9ea0 )
by Anton
02:12
created
src/Command/Views/CompileCommand.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -33,13 +33,13 @@  discard block
 block discarded – undo
33 33
         $generator = new ContextGenerator($views->getContext());
34 34
 
35 35
         $contexts = $generator->generate();
36
-        if (empty($contexts)) {
36
+        if (empty($contexts)){
37 37
             $contexts[] = $views->getContext();
38 38
         }
39 39
 
40
-        foreach ($contexts as $context) {
41
-            foreach ($views->getEngines() as $engine) {
42
-                if ($engine instanceof NativeEngine) {
40
+        foreach ($contexts as $context){
41
+            foreach ($views->getEngines() as $engine){
42
+                if ($engine instanceof NativeEngine){
43 43
                     // no need to compile
44 44
                     continue;
45 45
                 }
@@ -63,19 +63,19 @@  discard block
 block discarded – undo
63 63
             $this->describeContext($context) ?? "default"
64 64
         );
65 65
 
66
-        foreach ($engine->getLoader()->list() as $path) {
66
+        foreach ($engine->getLoader()->list() as $path){
67 67
             $start = microtime(true);
68
-            try {
68
+            try{
69 69
                 $engine->reset($path, $context);
70 70
                 $engine->compile($path, $context);
71 71
 
72
-                if ($this->isVerbose()) {
72
+                if ($this->isVerbose()){
73 73
                     $this->sprintf("<info>•</info> %s", $path);
74 74
                 }
75
-            } catch (\Throwable $e) {
75
+            }catch (\Throwable $e){
76 76
                 $this->renderError($path, $e);
77 77
                 continue;
78
-            } finally {
78
+            }finally{
79 79
                 $this->renderElapsed($start);
80 80
             }
81 81
         }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     {
92 92
         $values = [];
93 93
 
94
-        foreach ($context->getDependencies() as $dependency) {
94
+        foreach ($context->getDependencies() as $dependency){
95 95
             $values[] = sprintf(
96 96
                 "%s%s%s:%s%s%s",
97 97
                 Color::LIGHT_WHITE,
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
      */
124 124
     protected function renderError(string $path, \Throwable $e): void
125 125
     {
126
-        if (!$this->isVerbose()) {
126
+        if (!$this->isVerbose()){
127 127
             return;
128 128
         }
129 129
 
@@ -140,11 +140,11 @@  discard block
 block discarded – undo
140 140
      */
141 141
     private function renderSuccess(string $lastPath = null): void
142 142
     {
143
-        if (!$this->isVerbose()) {
143
+        if (!$this->isVerbose()){
144 144
             return;
145 145
         }
146 146
 
147
-        if ($lastPath === null) {
147
+        if ($lastPath === null){
148 148
             $this->writeln("• no views found");
149 149
         }
150 150
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      */
157 157
     private function renderElapsed(float $start): void
158 158
     {
159
-        if (!$this->isVerbose()) {
159
+        if (!$this->isVerbose()){
160 160
             return;
161 161
         }
162 162
 
Please login to merge, or discard this patch.
Braces   +30 added lines, -14 removed lines patch added patch discarded remove patch
@@ -33,13 +33,17 @@  discard block
 block discarded – undo
33 33
         $generator = new ContextGenerator($views->getContext());
34 34
 
35 35
         $contexts = $generator->generate();
36
-        if (empty($contexts)) {
36
+        if (empty($contexts))
37
+        {
37 38
             $contexts[] = $views->getContext();
38 39
         }
39 40
 
40
-        foreach ($contexts as $context) {
41
-            foreach ($views->getEngines() as $engine) {
42
-                if ($engine instanceof NativeEngine) {
41
+        foreach ($contexts as $context)
42
+        {
43
+            foreach ($views->getEngines() as $engine)
44
+            {
45
+                if ($engine instanceof NativeEngine)
46
+                {
43 47
                     // no need to compile
44 48
                     continue;
45 49
                 }
@@ -63,19 +67,26 @@  discard block
 block discarded – undo
63 67
             $this->describeContext($context) ?? "default"
64 68
         );
65 69
 
66
-        foreach ($engine->getLoader()->list() as $path) {
70
+        foreach ($engine->getLoader()->list() as $path)
71
+        {
67 72
             $start = microtime(true);
68
-            try {
73
+            try
74
+            {
69 75
                 $engine->reset($path, $context);
70 76
                 $engine->compile($path, $context);
71 77
 
72
-                if ($this->isVerbose()) {
78
+                if ($this->isVerbose())
79
+                {
73 80
                     $this->sprintf("<info>•</info> %s", $path);
74 81
                 }
75
-            } catch (\Throwable $e) {
82
+            }
83
+            catch (\Throwable $e)
84
+            {
76 85
                 $this->renderError($path, $e);
77 86
                 continue;
78
-            } finally {
87
+            }
88
+            finally
89
+            {
79 90
                 $this->renderElapsed($start);
80 91
             }
81 92
         }
@@ -91,7 +102,8 @@  discard block
 block discarded – undo
91 102
     {
92 103
         $values = [];
93 104
 
94
-        foreach ($context->getDependencies() as $dependency) {
105
+        foreach ($context->getDependencies() as $dependency)
106
+        {
95 107
             $values[] = sprintf(
96 108
                 "%s%s%s:%s%s%s",
97 109
                 Color::LIGHT_WHITE,
@@ -123,7 +135,8 @@  discard block
 block discarded – undo
123 135
      */
124 136
     protected function renderError(string $path, \Throwable $e): void
125 137
     {
126
-        if (!$this->isVerbose()) {
138
+        if (!$this->isVerbose())
139
+        {
127 140
             return;
128 141
         }
129 142
 
@@ -140,11 +153,13 @@  discard block
 block discarded – undo
140 153
      */
141 154
     private function renderSuccess(string $lastPath = null): void
142 155
     {
143
-        if (!$this->isVerbose()) {
156
+        if (!$this->isVerbose())
157
+        {
144 158
             return;
145 159
         }
146 160
 
147
-        if ($lastPath === null) {
161
+        if ($lastPath === null)
162
+        {
148 163
             $this->writeln("• no views found");
149 164
         }
150 165
 
@@ -156,7 +171,8 @@  discard block
 block discarded – undo
156 171
      */
157 172
     private function renderElapsed(float $start): void
158 173
     {
159
-        if (!$this->isVerbose()) {
174
+        if (!$this->isVerbose())
175
+        {
160 176
             return;
161 177
         }
162 178
 
Please login to merge, or discard this patch.
src/Command/Migrate/StatusCommand.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,18 +26,18 @@  discard block
 block discarded – undo
26 26
      */
27 27
     public function perform(FilesInterface $files)
28 28
     {
29
-        if (!$this->verifyConfigured()) {
29
+        if (!$this->verifyConfigured()){
30 30
             return;
31 31
         }
32 32
 
33
-        if (empty($this->migrator->getMigrations())) {
33
+        if (empty($this->migrator->getMigrations())){
34 34
             $this->writeln("<comment>No migrations were found.</comment>");
35 35
 
36 36
             return;
37 37
         }
38 38
 
39 39
         $table = $this->table(['Migration', 'Created at', 'Executed at']);
40
-        foreach ($this->migrator->getMigrations() as $migration) {
40
+        foreach ($this->migrator->getMigrations() as $migration){
41 41
             $state = $migration->getState();
42 42
 
43 43
             $table->addRow([
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
                 $state->getTimeCreated()->format('Y-m-d H:i:s'),
46 46
                 $state->getStatus() == State::STATUS_PENDING
47 47
                     ? self::PENDING
48
-                    : '<info>' . $state->getTimeExecuted()->format('Y-m-d H:i:s') . '</info>'
48
+                    : '<info>'.$state->getTimeExecuted()->format('Y-m-d H:i:s').'</info>'
49 49
             ]);
50 50
         }
51 51
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,18 +26,21 @@
 block discarded – undo
26 26
      */
27 27
     public function perform(FilesInterface $files)
28 28
     {
29
-        if (!$this->verifyConfigured()) {
29
+        if (!$this->verifyConfigured())
30
+        {
30 31
             return;
31 32
         }
32 33
 
33
-        if (empty($this->migrator->getMigrations())) {
34
+        if (empty($this->migrator->getMigrations()))
35
+        {
34 36
             $this->writeln("<comment>No migrations were found.</comment>");
35 37
 
36 38
             return;
37 39
         }
38 40
 
39 41
         $table = $this->table(['Migration', 'Created at', 'Executed at']);
40
-        foreach ($this->migrator->getMigrations() as $migration) {
42
+        foreach ($this->migrator->getMigrations() as $migration)
43
+        {
41 44
             $state = $migration->getState();
42 45
 
43 46
             $table->addRow([
Please login to merge, or discard this patch.
src/Http/RrDispacher.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         FinalizerInterface $finalizer,
47 47
         ContainerInterface $container,
48 48
         FactoryInterface $factory
49
-    ) {
49
+    ){
50 50
         $this->env = $env;
51 51
         $this->finalizer = $finalizer;
52 52
         $this->container = $container;
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
 
71 71
         /** @var Http $http */
72 72
         $http = $this->container->get(Http::class);
73
-        while ($request = $client->acceptRequest()) {
74
-            try {
73
+        while ($request = $client->acceptRequest()){
74
+            try{
75 75
                 $client->respond($http->handle($request));
76
-            } catch (\Throwable $e) {
76
+            }catch (\Throwable $e){
77 77
                 $this->handleException($client, $e);
78
-            } finally {
78
+            }finally{
79 79
                 $this->finalizer->finalize(false);
80 80
             }
81 81
         }
@@ -89,11 +89,11 @@  discard block
 block discarded – undo
89 89
     {
90 90
         $handler = new HtmlHandler();
91 91
 
92
-        try {
92
+        try{
93 93
             /** @var SnapshotInterface $snapshot */
94 94
             $snapshot = $this->container->get(SnapshotterInterface::class)->register($e);
95 95
             error_log($snapshot->getMessage());
96
-        } catch (\Throwable|ContainerExceptionInterface $se) {
96
+        }catch (\Throwable | ContainerExceptionInterface $se){
97 97
             error_log((string)$e);
98 98
         }
99 99
 
Please login to merge, or discard this patch.
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -70,12 +70,18 @@  discard block
 block discarded – undo
70 70
 
71 71
         /** @var Http $http */
72 72
         $http = $this->container->get(Http::class);
73
-        while ($request = $client->acceptRequest()) {
74
-            try {
73
+        while ($request = $client->acceptRequest())
74
+        {
75
+            try
76
+            {
75 77
                 $client->respond($http->handle($request));
76
-            } catch (\Throwable $e) {
78
+            }
79
+            catch (\Throwable $e)
80
+            {
77 81
                 $this->handleException($client, $e);
78
-            } finally {
82
+            }
83
+            finally
84
+            {
79 85
                 $this->finalizer->finalize(false);
80 86
             }
81 87
         }
@@ -89,11 +95,14 @@  discard block
 block discarded – undo
89 95
     {
90 96
         $handler = new HtmlHandler();
91 97
 
92
-        try {
98
+        try
99
+        {
93 100
             /** @var SnapshotInterface $snapshot */
94 101
             $snapshot = $this->container->get(SnapshotterInterface::class)->register($e);
95 102
             error_log($snapshot->getMessage());
96
-        } catch (\Throwable|ContainerExceptionInterface $se) {
103
+        }
104
+        catch (\Throwable|ContainerExceptionInterface $se)
105
+        {
97 106
             error_log((string)$e);
98 107
         }
99 108
 
Please login to merge, or discard this patch.
src/Http/SapiDispatcher.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
         $http = $this->container->get(Http::class);
58 58
         $emitter = $emitter ?? $this->container->get(EmitterInterface::class);
59 59
 
60
-        try {
60
+        try{
61 61
             $response = $http->handle($this->initRequest());
62 62
             $emitter->emit($response);
63
-        } catch (\Throwable $e) {
63
+        }catch (\Throwable $e){
64 64
             $this->handleException($emitter, $e);
65
-        } finally {
65
+        }finally{
66 66
             $this->finalizer->finalize(false);
67 67
         }
68 68
     }
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
     {
84 84
         $handler = new HtmlHandler();
85 85
 
86
-        try {
86
+        try{
87 87
             /** @var SnapshotInterface $snapshot */
88 88
             $this->container->get(SnapshotterInterface::class)->register($e);
89
-        } catch (\Throwable|ContainerExceptionInterface $se) {
89
+        }catch (\Throwable | ContainerExceptionInterface $se){
90 90
             // nothing to report
91 91
         }
92 92
 
Please login to merge, or discard this patch.
Braces   +13 added lines, -5 removed lines patch added patch discarded remove patch
@@ -57,12 +57,17 @@  discard block
 block discarded – undo
57 57
         $http = $this->container->get(Http::class);
58 58
         $emitter = $emitter ?? $this->container->get(EmitterInterface::class);
59 59
 
60
-        try {
60
+        try
61
+        {
61 62
             $response = $http->handle($this->initRequest());
62 63
             $emitter->emit($response);
63
-        } catch (\Throwable $e) {
64
+        }
65
+        catch (\Throwable $e)
66
+        {
64 67
             $this->handleException($emitter, $e);
65
-        } finally {
68
+        }
69
+        finally
70
+        {
66 71
             $this->finalizer->finalize(false);
67 72
         }
68 73
     }
@@ -83,10 +88,13 @@  discard block
 block discarded – undo
83 88
     {
84 89
         $handler = new HtmlHandler();
85 90
 
86
-        try {
91
+        try
92
+        {
87 93
             /** @var SnapshotInterface $snapshot */
88 94
             $this->container->get(SnapshotterInterface::class)->register($e);
89
-        } catch (\Throwable|ContainerExceptionInterface $se) {
95
+        }
96
+        catch (\Throwable|ContainerExceptionInterface $se)
97
+        {
90 98
             // nothing to report
91 99
         }
92 100
 
Please login to merge, or discard this patch.
src/Command/Cycle/UpdateCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
         CycleBootloader $cycleBootloader,
36 36
         Registry $registry,
37 37
         MemoryInterface $memory
38
-    ) {
38
+    ){
39 39
         $this->write("Updating ORM schema... ");
40 40
 
41 41
         $schema = (new Compiler())->compile($registry, $bootloader->getGenerators());
Please login to merge, or discard this patch.
src/Bootloader/Cycle/SchemaBootloader.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -89,11 +89,11 @@  discard block
 block discarded – undo
89 89
     public function getGenerators(): array
90 90
     {
91 91
         $result = [];
92
-        foreach ($this->generators as $group) {
93
-            foreach ($group as $generator) {
94
-                if (is_object($generator) && !$generator instanceof Container\Autowire) {
92
+        foreach ($this->generators as $group){
93
+            foreach ($group as $generator){
94
+                if (is_object($generator) && !$generator instanceof Container\Autowire){
95 95
                     $result[] = $generator;
96
-                } else {
96
+                }else{
97 97
                     $result[] = $this->container->get($generator);
98 98
                 }
99 99
             }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     protected function schema(MemoryInterface $memory): ?SchemaInterface
110 110
     {
111 111
         $schema = $memory->loadData('cycle');
112
-        if (is_null($schema)) {
112
+        if (is_null($schema)){
113 113
             return null;
114 114
         }
115 115
 
Please login to merge, or discard this patch.
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -89,11 +89,16 @@  discard block
 block discarded – undo
89 89
     public function getGenerators(): array
90 90
     {
91 91
         $result = [];
92
-        foreach ($this->generators as $group) {
93
-            foreach ($group as $generator) {
94
-                if (is_object($generator) && !$generator instanceof Container\Autowire) {
92
+        foreach ($this->generators as $group)
93
+        {
94
+            foreach ($group as $generator)
95
+            {
96
+                if (is_object($generator) && !$generator instanceof Container\Autowire)
97
+                {
95 98
                     $result[] = $generator;
96
-                } else {
99
+                }
100
+                else
101
+                {
97 102
                     $result[] = $this->container->get($generator);
98 103
                 }
99 104
             }
@@ -109,7 +114,8 @@  discard block
 block discarded – undo
109 114
     protected function schema(MemoryInterface $memory): ?SchemaInterface
110 115
     {
111 116
         $schema = $memory->loadData('cycle');
112
-        if (is_null($schema)) {
117
+        if (is_null($schema))
118
+        {
113 119
             return null;
114 120
         }
115 121
 
Please login to merge, or discard this patch.
src/Bootloader/Cycle/CycleBootloader.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
     public function boot(Container $container, FinalizerInterface $finalizer, SchemaInterface $schema = null)
47 47
     {
48 48
         $finalizer->addFinalizer(function () use ($container) {
49
-            if ($container->hasInstance(ORMInterface::class)) {
49
+            if ($container->hasInstance(ORMInterface::class)){
50 50
                 $container->get(ORMInterface::class)->getHeap()->clean();
51 51
             }
52 52
         });
53 53
 
54 54
         $container->bindInjector(Select::class, SelectInjector::class);
55 55
 
56
-        if ($schema !== null) {
56
+        if ($schema !== null){
57 57
             $this->bindRepositories($container, $schema);
58 58
         }
59 59
     }
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
      */
67 67
     public function bindRepositories(Container $container, SchemaInterface $schema)
68 68
     {
69
-        foreach ($schema->getRoles() as $role) {
69
+        foreach ($schema->getRoles() as $role){
70 70
             $repository = $schema->define($role, SchemaInterface::REPOSITORY);
71
-            if ($repository === Select\Repository::class || $repository === null) {
71
+            if ($repository === Select\Repository::class || $repository === null){
72 72
                 // default repository can not be wired
73 73
                 continue;
74 74
             }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     ): ORMInterface {
105 105
         $orm = new ORM($factory, $schema);
106 106
 
107
-        if ($promiseFactory !== null) {
107
+        if ($promiseFactory !== null){
108 108
             return $orm->withPromiseFactory($promiseFactory);
109 109
         }
110 110
 
Please login to merge, or discard this patch.
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -45,15 +45,18 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function boot(Container $container, FinalizerInterface $finalizer, SchemaInterface $schema = null)
47 47
     {
48
-        $finalizer->addFinalizer(function () use ($container) {
49
-            if ($container->hasInstance(ORMInterface::class)) {
48
+        $finalizer->addFinalizer(function () use ($container)
49
+        {
50
+            if ($container->hasInstance(ORMInterface::class))
51
+            {
50 52
                 $container->get(ORMInterface::class)->getHeap()->clean();
51 53
             }
52 54
         });
53 55
 
54 56
         $container->bindInjector(Select::class, SelectInjector::class);
55 57
 
56
-        if ($schema !== null) {
58
+        if ($schema !== null)
59
+        {
57 60
             $this->bindRepositories($container, $schema);
58 61
         }
59 62
     }
@@ -66,15 +69,18 @@  discard block
 block discarded – undo
66 69
      */
67 70
     public function bindRepositories(Container $container, SchemaInterface $schema)
68 71
     {
69
-        foreach ($schema->getRoles() as $role) {
72
+        foreach ($schema->getRoles() as $role)
73
+        {
70 74
             $repository = $schema->define($role, SchemaInterface::REPOSITORY);
71
-            if ($repository === Select\Repository::class || $repository === null) {
75
+            if ($repository === Select\Repository::class || $repository === null)
76
+            {
72 77
                 // default repository can not be wired
73 78
                 continue;
74 79
             }
75 80
 
76 81
             // initiate all repository dependencies using factory method forwarded to ORM
77
-            $container->bindSingleton($repository, function (ORMInterface $orm) use ($role) {
82
+            $container->bindSingleton($repository, function (ORMInterface $orm) use ($role)
83
+            {
78 84
                 return $orm->getRepository($role);
79 85
             });
80 86
         }
@@ -104,7 +110,8 @@  discard block
 block discarded – undo
104 110
     ): ORMInterface {
105 111
         $orm = new ORM($factory, $schema);
106 112
 
107
-        if ($promiseFactory !== null) {
113
+        if ($promiseFactory !== null)
114
+        {
108 115
             return $orm->withPromiseFactory($promiseFactory);
109 116
         }
110 117
 
Please login to merge, or discard this patch.
src/Bootloader/SnapshotsBootloader.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,9 +41,9 @@
 block discarded – undo
41 41
         EnvironmentInterface $env,
42 42
         DirectoriesInterface $dirs,
43 43
         FilesInterface $files
44
-    ) {
44
+    ){
45 45
         return new FileSnapshotter(
46
-            $dirs->get('runtime') . '/snapshots/',
46
+            $dirs->get('runtime').'/snapshots/',
47 47
             $env->get('SNAPSHOT_MAX_FILES', self::MAX_SNAPSHOTS),
48 48
             $env->get('SNAPSHOT_VERBOSITY', HandlerInterface::VERBOSITY_VERBOSE),
49 49
             new HtmlHandler(),
Please login to merge, or discard this patch.
src/Bootloader/Http/SessionBootloader.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         CookiesBootloader $cookies,
51 51
         HttpBootloader $http,
52 52
         DirectoriesInterface $directories
53
-    ) {
53
+    ){
54 54
         $config->setDefaults('session', [
55 55
             'lifetime' => 86400,
56 56
             'cookie'   => 'sid',
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
             'handler'  => new Autowire(
59 59
                 FileHandler::class,
60 60
                 [
61
-                    'directory' => $directories->get('runtime') . 'session',
61
+                    'directory' => $directories->get('runtime').'session',
62 62
                     'lifetime'  => 86400
63 63
                 ]
64 64
             )
Please login to merge, or discard this patch.