Passed
Pull Request — master (#9)
by Julien
04:54
created
src/Command/StartEventCommand.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -90,21 +90,21 @@  discard block
 block discarded – undo
90 90
         $this->output->writeln('Now, we need to find the root of your web application.');
91 91
         $appDirectory = $this->getAentHelper()->question('PHP application root directory (relative to the project root directory)')
92 92
             ->setHelpText('Your PHP application root directory is typically the directory that contains your composer.json file. It must be relative to the project root directory.')
93
-            ->setValidator(function (string $appDirectory) {
93
+            ->setValidator(function(string $appDirectory) {
94 94
                 $appDirectory = trim($appDirectory, '/') ?: '.';
95 95
                 $rootDir = Pheromone::getContainerProjectDirectory();
96 96
 
97
-                $fullDir = $rootDir.'/'.$appDirectory;
97
+                $fullDir = $rootDir . '/' . $appDirectory;
98 98
                 if (!is_dir($fullDir)) {
99
-                    throw new \InvalidArgumentException('Could not find directory '.Pheromone::getHostProjectDirectory().'/'.$appDirectory);
99
+                    throw new \InvalidArgumentException('Could not find directory ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory);
100 100
                 }
101 101
                 return $appDirectory;
102 102
             })->ask();
103 103
 
104
-        $this->output->writeln('<info>Your root PHP application directory is '.Pheromone::getHostProjectDirectory().'/'.$appDirectory.'</info>');
104
+        $this->output->writeln('<info>Your root PHP application directory is ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . '</info>');
105 105
         $this->getAentHelper()->spacer();
106 106
 
107
-        $service->addBindVolume('./'.$appDirectory, '/var/www/html');
107
+        $service->addBindVolume('./' . $appDirectory, '/var/www/html');
108 108
 
109 109
         /************************ Web application path **********************/
110 110
         if ($variant === 'apache') {
@@ -112,20 +112,20 @@  discard block
 block discarded – undo
112 112
                 ->yesNoQuestion()->setDefault('y')->ask();
113 113
             if ($answer) {
114 114
                 $webDirectory = $this->getAentHelper()->question('Web directory (relative to the PHP application directory)')
115
-                    ->setHelpText('Your PHP application web directory is typically the directory that contains your index.php file. It must be relative to the PHP application directory ('.Pheromone::getHostProjectDirectory().'/'.$appDirectory.')')
116
-                    ->setValidator(function (string $webDirectory) use ($appDirectory) {
115
+                    ->setHelpText('Your PHP application web directory is typically the directory that contains your index.php file. It must be relative to the PHP application directory (' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . ')')
116
+                    ->setValidator(function(string $webDirectory) use ($appDirectory) {
117 117
                         $webDirectory = trim($webDirectory, '/') ?: '.';
118 118
                         $rootDir = Pheromone::getContainerProjectDirectory();
119 119
 
120
-                        $fullDir = $rootDir.'/'.$appDirectory.'/'.$webDirectory;
120
+                        $fullDir = $rootDir . '/' . $appDirectory . '/' . $webDirectory;
121 121
                         if (!is_dir($fullDir)) {
122
-                            throw new \InvalidArgumentException('Could not find directory '.Pheromone::getHostProjectDirectory().'/'.$appDirectory.'/'.$webDirectory);
122
+                            throw new \InvalidArgumentException('Could not find directory ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . '/' . $webDirectory);
123 123
                         }
124 124
                         return $webDirectory;
125 125
                     })->ask();
126 126
 
127 127
                 $service->addImageEnvVariable('APACHE_DOCUMENT_ROOT', $webDirectory);
128
-                $this->output->writeln('<info>Your web directory is '.Pheromone::getHostProjectDirectory().'/'.$appDirectory.'/'.$webDirectory.'</info>');
128
+                $this->output->writeln('<info>Your web directory is ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . '/' . $webDirectory . '</info>');
129 129
                 $this->getAentHelper()->spacer();
130 130
             }
131 131
         }
@@ -147,19 +147,19 @@  discard block
 block discarded – undo
147 147
             $rootDir = Pheromone::getContainerProjectDirectory();
148 148
 
149 149
             if ($uploadDirectory !== '') {
150
-                $fullDir = $rootDir.'/'.$appDirectory.'/'.$uploadDirectory;
150
+                $fullDir = $rootDir . '/' . $appDirectory . '/' . $uploadDirectory;
151 151
                 if (!is_dir($fullDir)) {
152
-                    $this->output->writeln('<error>Could not find directory '.Pheromone::getHostProjectDirectory().'/'.$appDirectory.'/'.$uploadDirectory.'</error>');
152
+                    $this->output->writeln('<error>Could not find directory ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . '/' . $uploadDirectory . '</error>');
153 153
                     $uploadDirectory = null;
154 154
                 } else {
155 155
                     $uploadDirs[] = $uploadDirectory;
156
-                    $this->output->writeln('<info>Directory '.Pheromone::getHostProjectDirectory().'/'.$appDirectory.'/'.$uploadDirectory.' will be stored out of the container</info>');
156
+                    $this->output->writeln('<info>Directory ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . '/' . $uploadDirectory . ' will be stored out of the container</info>');
157 157
 
158 158
                     $volumeName = $this->getAentHelper()
159 159
                         ->question('Please input directory (for instance for file uploads) that you want to mount out of the container? (keep empty to ignore)')
160 160
                         ->setDefault('')
161 161
                         ->compulsory()
162
-                        ->setValidator(function (string $value) {
162
+                        ->setValidator(function(string $value) {
163 163
                             $value = trim($value);
164 164
                             if (!\preg_match('/^[a-zA-Z0-9_.-]+$/', $value)) {
165 165
                                 throw new \InvalidArgumentException('Invalid volume name "' . $value . '". Volume names can contain alphanumeric characters, and "_", ".", "-".');
@@ -169,16 +169,16 @@  discard block
 block discarded – undo
169 169
                         })
170 170
                         ->ask();
171 171
                     $question = new Question('What name should we use for this volume? ', '');
172
-                    $question->setValidator(function (string $value) {
172
+                    $question->setValidator(function(string $value) {
173 173
                         $value = trim($value);
174 174
                         if (!\preg_match('/^[a-zA-Z0-9_.-]+$/', $value)) {
175
-                            throw new \InvalidArgumentException('Invalid volume name "'.$value.'". Volume names can contain alphanumeric characters, and "_", ".", "-".');
175
+                            throw new \InvalidArgumentException('Invalid volume name "' . $value . '". Volume names can contain alphanumeric characters, and "_", ".", "-".');
176 176
                         }
177 177
 
178 178
                         return $value;
179 179
                     });
180 180
 
181
-                    $service->addNamedVolume($volumeName, $appDirectory.'/'.$uploadDirectory);
181
+                    $service->addNamedVolume($volumeName, $appDirectory . '/' . $uploadDirectory);
182 182
                 }
183 183
             }
184 184
         } while ($uploadDirectory !== '');
@@ -192,16 +192,16 @@  discard block
 block discarded – undo
192 192
         $this->output->writeln('By default, the following extensions are enabled:');
193 193
         $this->output->writeln('<info>apcu mysqli opcache pdo pdo_mysql redis zip soap mbstring ftp mysqlnd</info>');
194 194
         $this->output->writeln('You can select more extensions below:');
195
-        $this->output->writeln('<info>'.\implode(' ', $availableExtensions).'</info>');
195
+        $this->output->writeln('<info>' . \implode(' ', $availableExtensions) . '</info>');
196 196
 
197 197
         /************************ Extensions **********************/
198 198
         $extensions = [];
199 199
         do {
200 200
             $question = new Question('Please enter the name of an additional extension you want to install (keep empty to skip): ', '');
201 201
             $question->setAutocompleterValues($availableExtensions);
202
-            $question->setValidator(function (string $value) use ($availableExtensions) {
202
+            $question->setValidator(function(string $value) use ($availableExtensions) {
203 203
                 if (trim($value) !== '' && !\in_array($value, $availableExtensions)) {
204
-                    throw new \InvalidArgumentException('Unknown extension '.$value);
204
+                    throw new \InvalidArgumentException('Unknown extension ' . $value);
205 205
                 }
206 206
 
207 207
                 return trim($value);
@@ -210,11 +210,11 @@  discard block
 block discarded – undo
210 210
             $extension = $this->getHelper('question')->ask($this->input, $this->output, $question);
211 211
 
212 212
             if ($extension !== '') {
213
-                $service->addImageEnvVariable('PHP_EXTENSION_'.\strtoupper($extension), '1');
213
+                $service->addImageEnvVariable('PHP_EXTENSION_' . \strtoupper($extension), '1');
214 214
                 $extensions[] = $extension;
215 215
             }
216 216
         } while ($extension !== '');
217
-        $this->output->writeln('<info>Enabled extensions: apcu mysqli opcache pdo pdo_mysql redis zip soap mbstring ftp mysqlnd '.\implode(' ', $extensions).'</info>');
217
+        $this->output->writeln('<info>Enabled extensions: apcu mysqli opcache pdo pdo_mysql redis zip soap mbstring ftp mysqlnd ' . \implode(' ', $extensions) . '</info>');
218 218
         $this->getAentHelper()->spacer();
219 219
 
220 220
 
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
 
224 224
         $memoryLimit = $this->getAentHelper()->question('PHP <info>memory limit</info> (keep empty to stay with the default 128M)')
225 225
             ->setHelpText('This value will be used in the memory_limit option of PHP via the PHP_INI_MEMORY_LIMIT environment variable.')
226
-            ->setValidator(function (string $value) {
226
+            ->setValidator(function(string $value) {
227 227
                 if (trim($value) !== '' && !\preg_match('/^[0-9]+([MGK])?$/i', $value)) {
228
-                    throw new \InvalidArgumentException('Invalid value: '.$value);
228
+                    throw new \InvalidArgumentException('Invalid value: ' . $value);
229 229
                 }
230 230
 
231 231
                 return trim($value);
@@ -238,9 +238,9 @@  discard block
 block discarded – undo
238 238
 
239 239
         $uploadMaxFileSize = $this->getAentHelper()->question('<info>Maximum file size for uploaded files</info> (keep empty to stay with the default 2M)')
240 240
             ->setHelpText('This value will be used in the upload_max_file_size and post_max_size options of PHP via the PHP_INI_UPLOAD_MAX_FILESIZE and PHP_INI_POST_MAX_SIZE environment variables.')
241
-            ->setValidator(function (string $value) {
241
+            ->setValidator(function(string $value) {
242 242
                 if (trim($value) !== '' && !\preg_match('/^[0-9]+([MGK])?$/i', $value)) {
243
-                    throw new \InvalidArgumentException('Invalid value: '.$value);
243
+                    throw new \InvalidArgumentException('Invalid value: ' . $value);
244 244
                 }
245 245
 
246 246
                 return trim($value);
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 
264 264
             if ($depend !== '') {
265 265
                 $service->addDependsOn($depend);
266
-                $this->output->writeln('<info>Added dependency: '.$depend.'</info>');
266
+                $this->output->writeln('<info>Added dependency: ' . $depend . '</info>');
267 267
             }
268 268
         } while ($depend !== '');
269 269
         $this->getAentHelper()->spacer();
Please login to merge, or discard this patch.