Passed
Push — master ( 5e186e...dbb2e0 )
by Anton
02:56
created
src/Snapshots/FileSnapshotter.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -92,17 +92,23 @@
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
src/Controller/Traits/AuthorizesTrait.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
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(
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,8 @@
 block discarded – undo
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(
Please login to merge, or discard this patch.
src/Filter/RequestInput.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,8 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Command/Migrate/ReplayCommand.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,7 +26,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Command/Database/ListCommand.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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())]
Please login to merge, or discard this patch.
Braces   +20 added lines, -9 removed lines patch added patch discarded remove patch
@@ -32,13 +32,17 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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())]
Please login to merge, or discard this patch.
src/Command/PublishCommand.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
         Publisher $publisher,
54 54
         FilesInterface $files,
55 55
         DirectoriesInterface $directories
56
-    ) {
57
-        switch ($this->argument('type')) {
56
+    ){
57
+        switch ($this->argument('type')){
58 58
             case 'replace':
59 59
             case 'follow':
60
-                if ($this->isDirectory()) {
60
+                if ($this->isDirectory()){
61 61
                     $this->sprintf(
62 62
                         "<fg=cyan>•</fg=cyan> publish directory <comment>%s</comment> to <comment>%s</comment>",
63 63
                         $this->getSource($files, $directories),
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
                         $this->getMergeMode(),
71 71
                         $this->getFileMode()
72 72
                     );
73
-                } else {
73
+                }else{
74 74
                     $this->sprintf(
75 75
                         "<fg=cyan>•</fg=cyan> publish file <comment>%s</comment> to <comment>%s</comment>",
76 76
                         $this->getSource($files, $directories),
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      */
109 109
     private function getSource(FilesInterface $files, DirectoriesInterface $directories): ?string
110 110
     {
111
-        if (!$this->isDirectory()) {
111
+        if (!$this->isDirectory()){
112 112
             return $files->normalizePath($this->argument('source'));
113 113
         }
114 114
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     private function getTarget(FilesInterface $files, DirectoriesInterface $directories): ?string
124 124
     {
125 125
         $target = $this->argument('target');
126
-        foreach ($directories->getAll() as $alias => $value) {
126
+        foreach ($directories->getAll() as $alias => $value){
127 127
             $target = str_replace("@{$alias}", $value, $target);
128 128
         }
129 129
 
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
      */
136 136
     private function isDirectory(): bool
137 137
     {
138
-        if ($this->argument('type') == 'ensure') {
138
+        if ($this->argument('type') == 'ensure'){
139 139
             return true;
140 140
         }
141 141
 
142
-        if (strpos($this->argument('source'), '*') !== false) {
142
+        if (strpos($this->argument('source'), '*') !== false){
143 143
             return true;
144 144
         }
145 145
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
      */
152 152
     private function getMergeMode(): string
153 153
     {
154
-        switch ($this->argument('type')) {
154
+        switch ($this->argument('type')){
155 155
             case 'follow':
156 156
                 return PublisherInterface::FOLLOW;
157 157
             case 'replace':
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      */
167 167
     private function getFileMode(): int
168 168
     {
169
-        switch ($this->argument('mode')) {
169
+        switch ($this->argument('mode')){
170 170
             case 'readonly':
171 171
                 return FilesInterface::READONLY;
172 172
             case 'runtime':
Please login to merge, or discard this patch.
Braces   +19 added lines, -9 removed lines patch added patch discarded remove patch
@@ -54,10 +54,12 @@  discard block
 block discarded – undo
54 54
         FilesInterface $files,
55 55
         DirectoriesInterface $directories
56 56
     ) {
57
-        switch ($this->argument('type')) {
57
+        switch ($this->argument('type'))
58
+        {
58 59
             case 'replace':
59 60
             case 'follow':
60
-                if ($this->isDirectory()) {
61
+                if ($this->isDirectory())
62
+                {
61 63
                     $this->sprintf(
62 64
                         "<fg=cyan>•</fg=cyan> publish directory <comment>%s</comment> to <comment>%s</comment>",
63 65
                         $this->getSource($files, $directories),
@@ -70,7 +72,9 @@  discard block
 block discarded – undo
70 72
                         $this->getMergeMode(),
71 73
                         $this->getFileMode()
72 74
                     );
73
-                } else {
75
+                }
76
+                else
77
+                {
74 78
                     $this->sprintf(
75 79
                         "<fg=cyan>•</fg=cyan> publish file <comment>%s</comment> to <comment>%s</comment>",
76 80
                         $this->getSource($files, $directories),
@@ -108,7 +112,8 @@  discard block
 block discarded – undo
108 112
      */
109 113
     private function getSource(FilesInterface $files, DirectoriesInterface $directories): ?string
110 114
     {
111
-        if (!$this->isDirectory()) {
115
+        if (!$this->isDirectory())
116
+        {
112 117
             return $files->normalizePath($this->argument('source'));
113 118
         }
114 119
 
@@ -123,7 +128,8 @@  discard block
 block discarded – undo
123 128
     private function getTarget(FilesInterface $files, DirectoriesInterface $directories): ?string
124 129
     {
125 130
         $target = $this->argument('target');
126
-        foreach ($directories->getAll() as $alias => $value) {
131
+        foreach ($directories->getAll() as $alias => $value)
132
+        {
127 133
             $target = str_replace("@{$alias}", $value, $target);
128 134
         }
129 135
 
@@ -135,11 +141,13 @@  discard block
 block discarded – undo
135 141
      */
136 142
     private function isDirectory(): bool
137 143
     {
138
-        if ($this->argument('type') == 'ensure') {
144
+        if ($this->argument('type') == 'ensure')
145
+        {
139 146
             return true;
140 147
         }
141 148
 
142
-        if (strpos($this->argument('source'), '*') !== false) {
149
+        if (strpos($this->argument('source'), '*') !== false)
150
+        {
143 151
             return true;
144 152
         }
145 153
 
@@ -151,7 +159,8 @@  discard block
 block discarded – undo
151 159
      */
152 160
     private function getMergeMode(): string
153 161
     {
154
-        switch ($this->argument('type')) {
162
+        switch ($this->argument('type'))
163
+        {
155 164
             case 'follow':
156 165
                 return PublisherInterface::FOLLOW;
157 166
             case 'replace':
@@ -166,7 +175,8 @@  discard block
 block discarded – undo
166 175
      */
167 176
     private function getFileMode(): int
168 177
     {
169
-        switch ($this->argument('mode')) {
178
+        switch ($this->argument('mode'))
179
+        {
170 180
             case 'readonly':
171 181
                 return FilesInterface::READONLY;
172 182
             case 'runtime':
Please login to merge, or discard this patch.
src/Command/Translator/IndexCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
         CatalogueManager $manager,
39 39
         InvocationsInterface $invocations,
40 40
         ClassesInterface $classes
41
-    ) {
41
+    ){
42 42
         $catalogue = $manager->load(
43 43
             $this->argument('locale') ?? $config->getDefaultLocale()
44 44
         );
Please login to merge, or discard this patch.
src/Console/Logger/DebugListener.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public function __invoke(LogEvent $event)
51 51
     {
52
-        if (empty($this->output)) {
52
+        if (empty($this->output)){
53 53
             return;
54 54
         }
55 55
 
56
-        if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE) {
56
+        if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE){
57 57
             return;
58 58
         }
59 59
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function enable(): self
91 91
     {
92
-        if (!empty($this->logs)) {
92
+        if (!empty($this->logs)){
93 93
             $this->logs->addListener($this);
94 94
         }
95 95
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      */
104 104
     public function disable(): self
105 105
     {
106
-        if (!empty($this->logs)) {
106
+        if (!empty($this->logs)){
107 107
             $this->logs->removeListener($this);
108 108
         }
109 109
 
@@ -126,13 +126,13 @@  discard block
 block discarded – undo
126 126
      */
127 127
     private function getChannel(string $channel): string
128 128
     {
129
-        if (!class_exists($channel, false)) {
129
+        if (!class_exists($channel, false)){
130 130
             return "[{$channel}]";
131 131
         }
132 132
 
133
-        try {
133
+        try{
134 134
             $reflection = new \ReflectionClass($channel);
135
-        } catch (\ReflectionException $e) {
135
+        }catch (\ReflectionException $e){
136 136
             return $channel;
137 137
         }
138 138
 
@@ -146,10 +146,10 @@  discard block
 block discarded – undo
146 146
      */
147 147
     private function getMessage(bool $decorated, string $message)
148 148
     {
149
-        if (!$decorated) {
149
+        if (!$decorated){
150 150
             return $message;
151 151
         }
152 152
 
153
-        return Color::GRAY . $message . Color::RESET;
153
+        return Color::GRAY.$message.Color::RESET;
154 154
     }
155 155
 }
156 156
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +17 added lines, -8 removed lines patch added patch discarded remove patch
@@ -49,11 +49,13 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public function __invoke(LogEvent $event)
51 51
     {
52
-        if (empty($this->output)) {
52
+        if (empty($this->output))
53
+        {
53 54
             return;
54 55
         }
55 56
 
56
-        if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE) {
57
+        if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE)
58
+        {
57 59
             return;
58 60
         }
59 61
 
@@ -89,7 +91,8 @@  discard block
 block discarded – undo
89 91
      */
90 92
     public function enable(): self
91 93
     {
92
-        if (!empty($this->logs)) {
94
+        if (!empty($this->logs))
95
+        {
93 96
             $this->logs->addListener($this);
94 97
         }
95 98
 
@@ -103,7 +106,8 @@  discard block
 block discarded – undo
103 106
      */
104 107
     public function disable(): self
105 108
     {
106
-        if (!empty($this->logs)) {
109
+        if (!empty($this->logs))
110
+        {
107 111
             $this->logs->removeListener($this);
108 112
         }
109 113
 
@@ -126,13 +130,17 @@  discard block
 block discarded – undo
126 130
      */
127 131
     private function getChannel(string $channel): string
128 132
     {
129
-        if (!class_exists($channel, false)) {
133
+        if (!class_exists($channel, false))
134
+        {
130 135
             return "[{$channel}]";
131 136
         }
132 137
 
133
-        try {
138
+        try
139
+        {
134 140
             $reflection = new \ReflectionClass($channel);
135
-        } catch (\ReflectionException $e) {
141
+        }
142
+        catch (\ReflectionException $e)
143
+        {
136 144
             return $channel;
137 145
         }
138 146
 
@@ -146,7 +154,8 @@  discard block
 block discarded – undo
146 154
      */
147 155
     private function getMessage(bool $decorated, string $message)
148 156
     {
149
-        if (!$decorated) {
157
+        if (!$decorated)
158
+        {
150 159
             return $message;
151 160
         }
152 161
 
Please login to merge, or discard this patch.
src/Console/CommandLocator.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,8 +36,8 @@
 block discarded – undo
36 36
     public function locateCommands(): array
37 37
     {
38 38
         $commands = [];
39
-        foreach ($this->classes->getClasses(\Symfony\Component\Console\Command\Command::class) as $class) {
40
-            if ($class->isAbstract()) {
39
+        foreach ($this->classes->getClasses(\Symfony\Component\Console\Command\Command::class) as $class){
40
+            if ($class->isAbstract()){
41 41
                 continue;
42 42
             }
43 43
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,8 +36,10 @@
 block discarded – undo
36 36
     public function locateCommands(): array
37 37
     {
38 38
         $commands = [];
39
-        foreach ($this->classes->getClasses(\Symfony\Component\Console\Command\Command::class) as $class) {
40
-            if ($class->isAbstract()) {
39
+        foreach ($this->classes->getClasses(\Symfony\Component\Console\Command\Command::class) as $class)
40
+        {
41
+            if ($class->isAbstract())
42
+            {
41 43
                 continue;
42 44
             }
43 45
 
Please login to merge, or discard this patch.