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