Completed
Pull Request — master (#1)
by David
07:07
created
src/Command/AddEventCommand.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
 
33 33
         /************************ Service name **********************/
34 34
         $question = new Question('Please enter the name of the service [app]: ', 'app');
35
-        $question->setValidator(function (string $value) {
35
+        $question->setValidator(function(string $value) {
36 36
             $value = trim($value);
37 37
             if (!\preg_match('/^[a-zA-Z0-9_.-]+$/', $value)) {
38
-                throw new \InvalidArgumentException('Invalid service name "'.$value.'". Service names can contain alphanumeric characters, and "_", ".", "-".');
38
+                throw new \InvalidArgumentException('Invalid service name "' . $value . '". Service names can contain alphanumeric characters, and "_", ".", "-".');
39 39
             }
40 40
 
41 41
             return $value;
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         if ($node === 'No') {
92 92
             $node = '';
93 93
         } else {
94
-            $node = '-'.$node;
94
+            $node = '-' . $node;
95 95
         }
96 96
 
97 97
         $service->setImage("thecodingmachine/php:$phpVersion-v1-$variant$node");
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
             $appDirectory = trim($appDirectory, '/') ?: '.';
108 108
             $rootDir = Pheromone::getContainerProjectDirectory();
109 109
 
110
-            $fullDir = $rootDir.'/'.$appDirectory;
110
+            $fullDir = $rootDir . '/' . $appDirectory;
111 111
             if (!is_dir($fullDir)) {
112
-                $this->output->writeln('<error>Could not find directory '.Pheromone::getHostProjectDirectory().'/'.$appDirectory.'</error>');
112
+                $this->output->writeln('<error>Could not find directory ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . '</error>');
113 113
                 $appDirectory = null;
114 114
             }
115 115
         } while ($appDirectory === null);
116
-        $this->output->writeln('<info>Your root PHP application directory is '.Pheromone::getHostProjectDirectory().'/'.$appDirectory.'</info>');
116
+        $this->output->writeln('<info>Your root PHP application directory is ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . '</info>');
117 117
         $this->output->writeln('');
118 118
         $this->output->writeln('');
119 119
 
@@ -136,15 +136,15 @@  discard block
 block discarded – undo
136 136
                     $webDirectory = trim($webDirectory, '/') ?: '.';
137 137
                     $rootDir = Pheromone::getContainerProjectDirectory();
138 138
 
139
-                    $fullDir = $rootDir.'/'.$appDirectory.'/'.$webDirectory;
139
+                    $fullDir = $rootDir . '/' . $appDirectory . '/' . $webDirectory;
140 140
                     if (!is_dir($fullDir)) {
141
-                        $this->output->writeln('<error>Could not find directory '.Pheromone::getHostProjectDirectory().'/'.$appDirectory.'/'.$webDirectory.'</error>');
141
+                        $this->output->writeln('<error>Could not find directory ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . '/' . $webDirectory . '</error>');
142 142
                         $webDirectory = null;
143 143
                     }
144 144
                 } while ($webDirectory === null);
145 145
 
146 146
                 $service->addImageEnvVariable('APACHE_DOCUMENT_ROOT', $webDirectory);
147
-                $this->output->writeln('<info>Your web directory is '.Pheromone::getHostProjectDirectory().'/'.$appDirectory.'/'.$webDirectory.'</info>');
147
+                $this->output->writeln('<info>Your web directory is ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . '/' . $webDirectory . '</info>');
148 148
                 $this->output->writeln('');
149 149
                 $this->output->writeln('');
150 150
             }
@@ -165,26 +165,26 @@  discard block
 block discarded – undo
165 165
             $rootDir = Pheromone::getContainerProjectDirectory();
166 166
 
167 167
             if ($uploadDirectory !== '') {
168
-                $fullDir = $rootDir.'/'.$appDirectory.'/'.$uploadDirectory;
168
+                $fullDir = $rootDir . '/' . $appDirectory . '/' . $uploadDirectory;
169 169
                 if (!is_dir($fullDir)) {
170
-                    $this->output->writeln('<error>Could not find directory '.Pheromone::getHostProjectDirectory().'/'.$appDirectory.'/'.$uploadDirectory.'</error>');
170
+                    $this->output->writeln('<error>Could not find directory ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . '/' . $uploadDirectory . '</error>');
171 171
                     $uploadDirectory = null;
172 172
                 } else {
173 173
                     $uploadDirs[] = $uploadDirectory;
174
-                    $this->output->writeln('<info>Directory '.Pheromone::getHostProjectDirectory().'/'.$appDirectory.'/'.$uploadDirectory.' will be stored out of the container</info>');
174
+                    $this->output->writeln('<info>Directory ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . '/' . $uploadDirectory . ' will be stored out of the container</info>');
175 175
 
176 176
                     $question = new Question('What name should we use for this volume? ', '');
177
-                    $question->setValidator(function (string $value) {
177
+                    $question->setValidator(function(string $value) {
178 178
                         $value = trim($value);
179 179
                         if (!\preg_match('/^[a-zA-Z0-9_.-]+$/', $value)) {
180
-                            throw new \InvalidArgumentException('Invalid volume name "'.$value.'". Volume names can contain alphanumeric characters, and "_", ".", "-".');
180
+                            throw new \InvalidArgumentException('Invalid volume name "' . $value . '". Volume names can contain alphanumeric characters, and "_", ".", "-".');
181 181
                         }
182 182
 
183 183
                         return $value;
184 184
                     });
185 185
                     $volumeName = $helper->ask($this->input, $this->output, $question);
186 186
 
187
-                    $service->addNamedVolume($volumeName, $appDirectory.'/'.$uploadDirectory);
187
+                    $service->addNamedVolume($volumeName, $appDirectory . '/' . $uploadDirectory);
188 188
                 }
189 189
             }
190 190
         } while ($uploadDirectory !== '');
@@ -199,16 +199,16 @@  discard block
 block discarded – undo
199 199
         $this->output->writeln('By default, the following extensions are enabled:');
200 200
         $this->output->writeln('<info>apcu mysqli opcache pdo pdo_mysql redis zip soap mbstring ftp mysqlnd</info>');
201 201
         $this->output->writeln('You can select more extensions below:');
202
-        $this->output->writeln('<info>'.\implode(' ', $availableExtensions).'</info>');
202
+        $this->output->writeln('<info>' . \implode(' ', $availableExtensions) . '</info>');
203 203
 
204 204
         /************************ Extensions **********************/
205 205
         $extensions = [];
206 206
         do {
207 207
             $question = new Question('Please enter the name of an additional extension you want to install (keep empty to skip): ', '');
208 208
             $question->setAutocompleterValues($availableExtensions);
209
-            $question->setValidator(function (string $value) use ($availableExtensions) {
209
+            $question->setValidator(function(string $value) use ($availableExtensions) {
210 210
                 if (trim($value) !== '' && !\in_array($value, $availableExtensions)) {
211
-                    throw new \InvalidArgumentException('Unknown extension '.$value);
211
+                    throw new \InvalidArgumentException('Unknown extension ' . $value);
212 212
                 }
213 213
 
214 214
                 return trim($value);
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
             $extension = $helper->ask($this->input, $this->output, $question);
218 218
 
219 219
             if ($extension !== '') {
220
-                $service->addImageEnvVariable('PHP_EXTENSION_'.\strtoupper($extension), '1');
220
+                $service->addImageEnvVariable('PHP_EXTENSION_' . \strtoupper($extension), '1');
221 221
                 $extensions[] = $extension;
222 222
             }
223 223
         } while ($extension !== '');
224
-        $this->output->writeln('<info>Enabled extensions: apcu mysqli opcache pdo pdo_mysql redis zip soap mbstring ftp mysqlnd '.\implode(' ', $extensions).'</info>');
224
+        $this->output->writeln('<info>Enabled extensions: apcu mysqli opcache pdo pdo_mysql redis zip soap mbstring ftp mysqlnd ' . \implode(' ', $extensions) . '</info>');
225 225
         $this->output->writeln('');
226 226
         $this->output->writeln('');
227 227
 
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
         /************************ php.ini settings **********************/
230 230
         $this->output->writeln("Now, let's customize some settings of <info>php.ini</info>.");
231 231
         $question = new Question('Please specify the PHP <info>memory limit</info> (keep empty to stay with the default 128M): ', '');
232
-        $question->setValidator(function (string $value) {
232
+        $question->setValidator(function(string $value) {
233 233
             if (trim($value) !== '' && !\preg_match('/^[0-9]+([MGK])?$/i', $value)) {
234
-                throw new \InvalidArgumentException('Invalid value: '.$value);
234
+                throw new \InvalidArgumentException('Invalid value: ' . $value);
235 235
             }
236 236
 
237 237
             return trim($value);
@@ -243,9 +243,9 @@  discard block
 block discarded – undo
243 243
         }
244 244
 
245 245
         $question = new Question('Please specify the <info>maximum file size for uploaded files</info> (keep empty to stay with the default 2M): ', '');
246
-        $question->setValidator(function (string $value) {
246
+        $question->setValidator(function(string $value) {
247 247
             if (trim($value) !== '' && !\preg_match('/^[0-9]+([MGK])?$/i', $value)) {
248
-                throw new \InvalidArgumentException('Invalid value: '.$value);
248
+                throw new \InvalidArgumentException('Invalid value: ' . $value);
249 249
             }
250 250
 
251 251
             return $value;
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 
269 269
             if ($depend !== '') {
270 270
                 $service->addDependsOn($depend);
271
-                $this->output->writeln('<info>Added dependency: '.$depend.'</info>');
271
+                $this->output->writeln('<info>Added dependency: ' . $depend . '</info>');
272 272
             }
273 273
         } while ($depend !== '');
274 274
         $this->output->writeln('');
Please login to merge, or discard this patch.