@@ -69,7 +69,7 @@ |
||
69 | 69 | { |
70 | 70 | $kernel->addDispatcher($factory->make(SapiDispatcher::class)); |
71 | 71 | |
72 | - if (class_exists(PSR7Client::class)) { |
|
72 | + if (class_exists(PSR7Client::class)){ |
|
73 | 73 | $kernel->addDispatcher($factory->make(RrDispacher::class)); |
74 | 74 | } |
75 | 75 |
@@ -69,7 +69,8 @@ |
||
69 | 69 | { |
70 | 70 | $kernel->addDispatcher($factory->make(SapiDispatcher::class)); |
71 | 71 | |
72 | - if (class_exists(PSR7Client::class)) { |
|
72 | + if (class_exists(PSR7Client::class)) |
|
73 | + { |
|
73 | 74 | $kernel->addDispatcher($factory->make(RrDispacher::class)); |
74 | 75 | } |
75 | 76 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | PermissionsInterface $permissions, |
41 | 41 | ContainerInterface $actorScope, |
42 | 42 | array $roles = [] |
43 | - ) { |
|
43 | + ){ |
|
44 | 44 | $this->roles = $roles; |
45 | 45 | $this->container = $actorScope; |
46 | 46 | $this->permissions = $permissions; |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | public function allows(string $permission, array $context = []): bool |
53 | 53 | { |
54 | 54 | $allows = false; |
55 | - foreach ($this->getRoles() as $role) { |
|
56 | - if (!$this->permissions->hasRole($role)) { |
|
55 | + foreach ($this->getRoles() as $role){ |
|
56 | + if (!$this->permissions->hasRole($role)){ |
|
57 | 57 | continue; |
58 | 58 | } |
59 | 59 | |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function getActor(): ActorInterface |
101 | 101 | { |
102 | - if (!is_null($this->actor)) { |
|
102 | + if (!is_null($this->actor)){ |
|
103 | 103 | return $this->actor; |
104 | 104 | } |
105 | 105 | |
106 | - try { |
|
106 | + try{ |
|
107 | 107 | return $this->container->get(ActorInterface::class); |
108 | - } catch (ContainerException $e) { |
|
108 | + }catch (ContainerException $e){ |
|
109 | 109 | throw new ScopeException("Unable to resolve Actor from the scope", $e->getCode(), $e); |
110 | 110 | } |
111 | 111 | } |
@@ -52,8 +52,10 @@ discard block |
||
52 | 52 | public function allows(string $permission, array $context = []): bool |
53 | 53 | { |
54 | 54 | $allows = false; |
55 | - foreach ($this->getRoles() as $role) { |
|
56 | - if (!$this->permissions->hasRole($role)) { |
|
55 | + foreach ($this->getRoles() as $role) |
|
56 | + { |
|
57 | + if (!$this->permissions->hasRole($role)) |
|
58 | + { |
|
57 | 59 | continue; |
58 | 60 | } |
59 | 61 | |
@@ -99,13 +101,17 @@ discard block |
||
99 | 101 | */ |
100 | 102 | public function getActor(): ActorInterface |
101 | 103 | { |
102 | - if (!is_null($this->actor)) { |
|
104 | + if (!is_null($this->actor)) |
|
105 | + { |
|
103 | 106 | return $this->actor; |
104 | 107 | } |
105 | 108 | |
106 | - try { |
|
109 | + try |
|
110 | + { |
|
107 | 111 | return $this->container->get(ActorInterface::class); |
108 | - } catch (ContainerException $e) { |
|
112 | + } |
|
113 | + catch (ContainerException $e) |
|
114 | + { |
|
109 | 115 | throw new ScopeException("Unable to resolve Actor from the scope", $e->getCode(), $e); |
110 | 116 | } |
111 | 117 | } |
@@ -39,28 +39,28 @@ |
||
39 | 39 | */ |
40 | 40 | protected function mapDirectories(array $directories): array |
41 | 41 | { |
42 | - if (!isset($directories['root'])) { |
|
42 | + if (!isset($directories['root'])){ |
|
43 | 43 | throw new BootException("Missing required directory `root`."); |
44 | 44 | } |
45 | 45 | |
46 | - if (!isset($directories['app'])) { |
|
47 | - $directories['app'] = $directories['root'] . '/app/'; |
|
46 | + if (!isset($directories['app'])){ |
|
47 | + $directories['app'] = $directories['root'].'/app/'; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return array_merge([ |
51 | 51 | // public root |
52 | - 'public' => $directories['root'] . '/public/', |
|
52 | + 'public' => $directories['root'].'/public/', |
|
53 | 53 | |
54 | 54 | // vendor libraries |
55 | - 'vendor' => $directories['root'] . '/vendor/', |
|
55 | + 'vendor' => $directories['root'].'/vendor/', |
|
56 | 56 | |
57 | 57 | // data directories |
58 | - 'runtime' => $directories['root'] . '/runtime/', |
|
59 | - 'cache' => $directories['root'] . '/runtime/cache/', |
|
58 | + 'runtime' => $directories['root'].'/runtime/', |
|
59 | + 'cache' => $directories['root'].'/runtime/cache/', |
|
60 | 60 | |
61 | 61 | // application directories |
62 | - 'config' => $directories['app'] . '/config/', |
|
63 | - 'resources' => $directories['app'] . '/resources/', |
|
62 | + 'config' => $directories['app'].'/config/', |
|
63 | + 'resources' => $directories['app'].'/resources/', |
|
64 | 64 | ], $directories); |
65 | 65 | } |
66 | 66 | } |
67 | 67 | \ No newline at end of file |
@@ -39,11 +39,13 @@ |
||
39 | 39 | */ |
40 | 40 | protected function mapDirectories(array $directories): array |
41 | 41 | { |
42 | - if (!isset($directories['root'])) { |
|
42 | + if (!isset($directories['root'])) |
|
43 | + { |
|
43 | 44 | throw new BootException("Missing required directory `root`."); |
44 | 45 | } |
45 | 46 | |
46 | - if (!isset($directories['app'])) { |
|
47 | + if (!isset($directories['app'])) |
|
48 | + { |
|
47 | 49 | $directories['app'] = $directories['root'] . '/app/'; |
48 | 50 | } |
49 | 51 |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | int $verbosity, |
49 | 49 | HandlerInterface $handler, |
50 | 50 | FilesInterface $files |
51 | - ) { |
|
51 | + ){ |
|
52 | 52 | $this->directory = $directory; |
53 | 53 | $this->maxFiles = $maxFiles; |
54 | 54 | $this->verbosity = $verbosity; |
@@ -92,17 +92,17 @@ discard block |
||
92 | 92 | protected function rotateSnapshots() |
93 | 93 | { |
94 | 94 | $finder = new Finder(); |
95 | - $finder->in($this->directory)->sort(function (SplFileInfo $a, SplFileInfo $b) { |
|
95 | + $finder->in($this->directory)->sort(function (SplFileInfo $a, SplFileInfo $b){ |
|
96 | 96 | return $b->getMTime() - $a->getMTime(); |
97 | 97 | }); |
98 | 98 | |
99 | 99 | $count = 0; |
100 | - foreach ($finder as $file) { |
|
100 | + foreach ($finder as $file){ |
|
101 | 101 | $count++; |
102 | - if ($count > $this->maxFiles) { |
|
103 | - try { |
|
102 | + if ($count > $this->maxFiles){ |
|
103 | + try{ |
|
104 | 104 | $this->files->delete($file->getRealPath()); |
105 | - } catch (FilesException $e) { |
|
105 | + }catch (FilesException $e){ |
|
106 | 106 | // ignore |
107 | 107 | } |
108 | 108 | } |
@@ -92,17 +92,23 @@ |
||
92 | 92 | protected function rotateSnapshots() |
93 | 93 | { |
94 | 94 | $finder = new Finder(); |
95 | - $finder->in($this->directory)->sort(function (SplFileInfo $a, SplFileInfo $b) { |
|
95 | + $finder->in($this->directory)->sort(function (SplFileInfo $a, SplFileInfo $b) |
|
96 | + { |
|
96 | 97 | return $b->getMTime() - $a->getMTime(); |
97 | 98 | }); |
98 | 99 | |
99 | 100 | $count = 0; |
100 | - foreach ($finder as $file) { |
|
101 | + foreach ($finder as $file) |
|
102 | + { |
|
101 | 103 | $count++; |
102 | - if ($count > $this->maxFiles) { |
|
103 | - try { |
|
104 | + if ($count > $this->maxFiles) |
|
105 | + { |
|
106 | + try |
|
107 | + { |
|
104 | 108 | $this->files->delete($file->getRealPath()); |
105 | - } catch (FilesException $e) { |
|
109 | + } |
|
110 | + catch (FilesException $e) |
|
111 | + { |
|
106 | 112 | // ignore |
107 | 113 | } |
108 | 114 | } |
@@ -30,7 +30,7 @@ |
||
30 | 30 | */ |
31 | 31 | protected function authorize(string $permission, array $context = []): bool |
32 | 32 | { |
33 | - if (!$this->allows($permission, $context)) { |
|
33 | + if (!$this->allows($permission, $context)){ |
|
34 | 34 | $name = $this->resolvePermission($permission); |
35 | 35 | |
36 | 36 | throw new ControllerException( |
@@ -30,7 +30,8 @@ |
||
30 | 30 | */ |
31 | 31 | protected function authorize(string $permission, array $context = []): bool |
32 | 32 | { |
33 | - if (!$this->allows($permission, $context)) { |
|
33 | + if (!$this->allows($permission, $context)) |
|
34 | + { |
|
34 | 35 | $name = $this->resolvePermission($permission); |
35 | 36 | |
36 | 37 | throw new ControllerException( |
@@ -41,7 +41,7 @@ |
||
41 | 41 | */ |
42 | 42 | public function getValue(string $source, string $name = null) |
43 | 43 | { |
44 | - if (!method_exists($this->input, $source)) { |
|
44 | + if (!method_exists($this->input, $source)){ |
|
45 | 45 | throw new InputException("Undefined input source '{$source}'"); |
46 | 46 | } |
47 | 47 |
@@ -41,7 +41,8 @@ |
||
41 | 41 | */ |
42 | 42 | public function getValue(string $source, string $name = null) |
43 | 43 | { |
44 | - if (!method_exists($this->input, $source)) { |
|
44 | + if (!method_exists($this->input, $source)) |
|
45 | + { |
|
45 | 46 | throw new InputException("Undefined input source '{$source}'"); |
46 | 47 | } |
47 | 48 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function perform(Console $console) |
28 | 28 | { |
29 | - if (!$this->verifyEnvironment()) { |
|
29 | + if (!$this->verifyEnvironment()){ |
|
30 | 30 | //Making sure we can safely migrate in this environment |
31 | 31 | return; |
32 | 32 | } |
@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | $rollback = ['--force' => true]; |
35 | 35 | $migrate = ['--force' => true]; |
36 | 36 | |
37 | - if ($this->option('all')) { |
|
37 | + if ($this->option('all')){ |
|
38 | 38 | $rollback['--all'] = true; |
39 | - } else { |
|
39 | + }else{ |
|
40 | 40 | $migrate['--one'] = true; |
41 | 41 | } |
42 | 42 |
@@ -26,7 +26,8 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function perform(Console $console) |
28 | 28 | { |
29 | - if (!$this->verifyEnvironment()) { |
|
29 | + if (!$this->verifyEnvironment()) |
|
30 | + { |
|
30 | 31 | //Making sure we can safely migrate in this environment |
31 | 32 | return; |
32 | 33 | } |
@@ -34,9 +35,12 @@ discard block |
||
34 | 35 | $rollback = ['--force' => true]; |
35 | 36 | $migrate = ['--force' => true]; |
36 | 37 | |
37 | - if ($this->option('all')) { |
|
38 | + if ($this->option('all')) |
|
39 | + { |
|
38 | 40 | $rollback['--all'] = true; |
39 | - } else { |
|
41 | + } |
|
42 | + else |
|
43 | + { |
|
40 | 44 | $migrate['--one'] = true; |
41 | 45 | } |
42 | 46 |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function perform(DatabaseConfig $config, DatabaseManager $dbal) |
34 | 34 | { |
35 | - if ($this->argument('db')) { |
|
35 | + if ($this->argument('db')){ |
|
36 | 36 | $databases = [$this->argument('db')]; |
37 | - } else { |
|
37 | + }else{ |
|
38 | 38 | $databases = array_keys($config->getDatabases()); |
39 | 39 | } |
40 | 40 | |
41 | - if (empty($databases)) { |
|
41 | + if (empty($databases)){ |
|
42 | 42 | $this->writeln("<fg=red>No databases found.</fg=red>"); |
43 | 43 | |
44 | 44 | return; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | 'Count Records:' |
55 | 55 | ]); |
56 | 56 | |
57 | - foreach ($databases as $database) { |
|
57 | + foreach ($databases as $database){ |
|
58 | 58 | $database = $dbal->database($database); |
59 | 59 | |
60 | 60 | /** @var Driver $driver */ |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | $database->getPrefix() ?: '<comment>---</comment>' |
68 | 68 | ]; |
69 | 69 | |
70 | - try { |
|
70 | + try{ |
|
71 | 71 | $driver->connect(); |
72 | - } catch (\Exception $exception) { |
|
72 | + }catch (\Exception $exception){ |
|
73 | 73 | $this->renderException($grid, $header, $exception); |
74 | 74 | |
75 | - if ($database->getName() != end($databases)) { |
|
75 | + if ($database->getName() != end($databases)){ |
|
76 | 76 | $grid->addRow(new TableSeparator()); |
77 | 77 | } |
78 | 78 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | $header[] = "<info>connected</info>"; |
83 | 83 | $this->renderTables($grid, $header, $database); |
84 | - if ($database->getName() != end($databases)) { |
|
84 | + if ($database->getName() != end($databases)){ |
|
85 | 85 | $grid->addRow(new TableSeparator()); |
86 | 86 | } |
87 | 87 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | private function renderTables(Table $grid, array $header, Database $database) |
115 | 115 | { |
116 | - foreach ($database->getTables() as $table) { |
|
116 | + foreach ($database->getTables() as $table){ |
|
117 | 117 | $grid->addRow(array_merge( |
118 | 118 | $header, |
119 | 119 | [$table->getName(), number_format($table->count())] |
@@ -32,13 +32,17 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function perform(DatabaseConfig $config, DatabaseManager $dbal) |
34 | 34 | { |
35 | - if ($this->argument('db')) { |
|
35 | + if ($this->argument('db')) |
|
36 | + { |
|
36 | 37 | $databases = [$this->argument('db')]; |
37 | - } else { |
|
38 | + } |
|
39 | + else |
|
40 | + { |
|
38 | 41 | $databases = array_keys($config->getDatabases()); |
39 | 42 | } |
40 | 43 | |
41 | - if (empty($databases)) { |
|
44 | + if (empty($databases)) |
|
45 | + { |
|
42 | 46 | $this->writeln("<fg=red>No databases found.</fg=red>"); |
43 | 47 | |
44 | 48 | return; |
@@ -54,7 +58,8 @@ discard block |
||
54 | 58 | 'Count Records:' |
55 | 59 | ]); |
56 | 60 | |
57 | - foreach ($databases as $database) { |
|
61 | + foreach ($databases as $database) |
|
62 | + { |
|
58 | 63 | $database = $dbal->database($database); |
59 | 64 | |
60 | 65 | /** @var Driver $driver */ |
@@ -67,12 +72,16 @@ discard block |
||
67 | 72 | $database->getPrefix() ?: '<comment>---</comment>' |
68 | 73 | ]; |
69 | 74 | |
70 | - try { |
|
75 | + try |
|
76 | + { |
|
71 | 77 | $driver->connect(); |
72 | - } catch (\Exception $exception) { |
|
78 | + } |
|
79 | + catch (\Exception $exception) |
|
80 | + { |
|
73 | 81 | $this->renderException($grid, $header, $exception); |
74 | 82 | |
75 | - if ($database->getName() != end($databases)) { |
|
83 | + if ($database->getName() != end($databases)) |
|
84 | + { |
|
76 | 85 | $grid->addRow(new TableSeparator()); |
77 | 86 | } |
78 | 87 | |
@@ -81,7 +90,8 @@ discard block |
||
81 | 90 | |
82 | 91 | $header[] = "<info>connected</info>"; |
83 | 92 | $this->renderTables($grid, $header, $database); |
84 | - if ($database->getName() != end($databases)) { |
|
93 | + if ($database->getName() != end($databases)) |
|
94 | + { |
|
85 | 95 | $grid->addRow(new TableSeparator()); |
86 | 96 | } |
87 | 97 | } |
@@ -113,7 +123,8 @@ discard block |
||
113 | 123 | */ |
114 | 124 | private function renderTables(Table $grid, array $header, Database $database) |
115 | 125 | { |
116 | - foreach ($database->getTables() as $table) { |
|
126 | + foreach ($database->getTables() as $table) |
|
127 | + { |
|
117 | 128 | $grid->addRow(array_merge( |
118 | 129 | $header, |
119 | 130 | [$table->getName(), number_format($table->count())] |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | SchemaBootloader $bootloader, |
32 | 32 | Registry $registry, |
33 | 33 | MemoryInterface $memory |
34 | - ) { |
|
35 | - if (!$this->verifyEnvironment()) { |
|
34 | + ){ |
|
35 | + if (!$this->verifyEnvironment()){ |
|
36 | 36 | return; |
37 | 37 | } |
38 | 38 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | $memory->saveData('cycle', $schema); |
47 | 47 | |
48 | - if ($show->hasChanges()) { |
|
48 | + if ($show->hasChanges()){ |
|
49 | 49 | $this->writeln("\n<info>ORM Schema has been synchronized</info>"); |
50 | 50 | } |
51 | 51 |
@@ -32,7 +32,8 @@ discard block |
||
32 | 32 | Registry $registry, |
33 | 33 | MemoryInterface $memory |
34 | 34 | ) { |
35 | - if (!$this->verifyEnvironment()) { |
|
35 | + if (!$this->verifyEnvironment()) |
|
36 | + { |
|
36 | 37 | return; |
37 | 38 | } |
38 | 39 | |
@@ -45,7 +46,8 @@ discard block |
||
45 | 46 | |
46 | 47 | $memory->saveData('cycle', $schema); |
47 | 48 | |
48 | - if ($show->hasChanges()) { |
|
49 | + if ($show->hasChanges()) |
|
50 | + { |
|
49 | 51 | $this->writeln("\n<info>ORM Schema has been synchronized</info>"); |
50 | 52 | } |
51 | 53 |