Completed
Push — master ( bd172c...ac109a )
by Jindun
12s
created
src/Command/StartEventCommand.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -94,20 +94,20 @@  discard block
 block discarded – undo
94 94
         $this->output->writeln('Now, we need to find the root of your web application.');
95 95
         $appDirectory = $this->getAentHelper()->question('PHP application root directory (relative to the project root directory)')
96 96
             ->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.')
97
-            ->setValidator(function (string $appDirectory) {
97
+            ->setValidator(function(string $appDirectory) {
98 98
                 $appDirectory = trim($appDirectory, '/') ?: '.';
99 99
                 $rootDir = Pheromone::getContainerProjectDirectory();
100 100
 
101
-                $fullDir = $rootDir.'/'.$appDirectory;
101
+                $fullDir = $rootDir . '/' . $appDirectory;
102 102
                 if (!is_dir($fullDir)) {
103
-                    throw new \InvalidArgumentException('Could not find directory '.Pheromone::getHostProjectDirectory().'/'.$appDirectory);
103
+                    throw new \InvalidArgumentException('Could not find directory ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory);
104 104
                 }
105 105
                 return $appDirectory;
106 106
             })->ask();
107 107
 
108
-        $this->output->writeln('<info>Your root PHP application directory is '.Pheromone::getHostProjectDirectory().'/'.$appDirectory.'</info>');
108
+        $this->output->writeln('<info>Your root PHP application directory is ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . '</info>');
109 109
 
110
-        $service->addBindVolume('./'.$appDirectory, '/var/www/html');
110
+        $service->addBindVolume('./' . $appDirectory, '/var/www/html');
111 111
 
112 112
         /************************ Web application path **********************/
113 113
         if ($variant === 'apache') {
@@ -115,19 +115,19 @@  discard block
 block discarded – undo
115 115
                 ->yesNoQuestion()->setDefault('y')->ask();
116 116
             if ($answer) {
117 117
                 $webDirectory = $this->getAentHelper()->question('Web directory (relative to the PHP application directory)')
118
-                    ->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.')')
119
-                    ->setValidator(function (string $webDirectory) use ($appDirectory) {
118
+                    ->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 . ')')
119
+                    ->setValidator(function(string $webDirectory) use ($appDirectory) {
120 120
                         $webDirectory = trim($webDirectory, '/') ?: '.';
121 121
                         $rootDir = Pheromone::getContainerProjectDirectory();
122 122
 
123
-                        $fullDir = $rootDir.'/'.$appDirectory.'/'.$webDirectory;
123
+                        $fullDir = $rootDir . '/' . $appDirectory . '/' . $webDirectory;
124 124
                         if (!is_dir($fullDir)) {
125
-                            throw new \InvalidArgumentException('Could not find directory '.Pheromone::getHostProjectDirectory().'/'.$appDirectory.'/'.$webDirectory);
125
+                            throw new \InvalidArgumentException('Could not find directory ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . '/' . $webDirectory);
126 126
                         }
127 127
                         return $webDirectory;
128 128
                     })->ask();
129 129
                 $service->addImageEnvVariable('APACHE_DOCUMENT_ROOT', $webDirectory);
130
-                $this->output->writeln('<info>Your web directory is '.Pheromone::getHostProjectDirectory().'/'.$appDirectory.'/'.$webDirectory.'</info>');
130
+                $this->output->writeln('<info>Your web directory is ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . '/' . $webDirectory . '</info>');
131 131
             }
132 132
         }
133 133
 
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
             $uploadDirectory = trim($uploadDirectory, '/');
146 146
             $rootDir = Pheromone::getContainerProjectDirectory();
147 147
             if ($uploadDirectory !== '') {
148
-                $fullDir = $rootDir.'/'.$appDirectory.'/'.$uploadDirectory;
148
+                $fullDir = $rootDir . '/' . $appDirectory . '/' . $uploadDirectory;
149 149
                 if (!is_dir($fullDir)) {
150
-                    $this->output->writeln('<error>Could not find directory '.Pheromone::getHostProjectDirectory().'/'.$appDirectory.'/'.$uploadDirectory.'</error>');
150
+                    $this->output->writeln('<error>Could not find directory ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . '/' . $uploadDirectory . '</error>');
151 151
                     $uploadDirectory = null;
152 152
                 } else {
153 153
                     $uploadDirs[] = $uploadDirectory;
154
-                    $this->output->writeln('<info>Directory '.Pheromone::getHostProjectDirectory().'/'.$appDirectory.'/'.$uploadDirectory.' will be stored out of the container</info>');
154
+                    $this->output->writeln('<info>Directory ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . '/' . $uploadDirectory . ' will be stored out of the container</info>');
155 155
 
156 156
                     $volumeName = $this->getAentHelper()
157 157
                         ->question('Please input directory (for instance for file uploads) that you want to mount out of the container? (keep empty to ignore)')
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
                         ->ask();
161 161
                     $question = new Question('What name should we use for this volume? ', '');
162 162
                     $question->setValidator(CommonValidators::getAlphaValidator(['_', '.', '-']));
163
-                    $service->addNamedVolume($volumeName, $appDirectory.'/'.$uploadDirectory);
163
+                    $service->addNamedVolume($volumeName, $appDirectory . '/' . $uploadDirectory);
164 164
                 }
165 165
             }
166 166
         } while ($uploadDirectory !== '');
@@ -173,35 +173,35 @@  discard block
 block discarded – undo
173 173
         $this->output->writeln('By default, the following extensions are enabled:');
174 174
         $this->output->writeln('<info>apcu mysqli opcache pdo pdo_mysql redis zip soap mbstring ftp mysqlnd</info>');
175 175
         $this->output->writeln('You can select more extensions below:');
176
-        $this->output->writeln('<info>'.\implode(' ', $availableExtensions).'</info>');
176
+        $this->output->writeln('<info>' . \implode(' ', $availableExtensions) . '</info>');
177 177
 
178 178
         /************************ Extensions **********************/
179 179
         $extensions = [];
180 180
         do {
181 181
             $question = new Question('Please enter the name of an additional extension you want to install (keep empty to skip): ', '');
182 182
             $question->setAutocompleterValues($availableExtensions);
183
-            $question->setValidator(function (string $value) use ($availableExtensions) {
183
+            $question->setValidator(function(string $value) use ($availableExtensions) {
184 184
                 if (trim($value) !== '' && !\in_array($value, $availableExtensions, true)) {
185
-                    throw new \InvalidArgumentException('Unknown extension '.$value);
185
+                    throw new \InvalidArgumentException('Unknown extension ' . $value);
186 186
                 }
187 187
                 return trim($value);
188 188
             });
189 189
             $extension = $this->getHelper('question')->ask($this->input, $this->output, $question);
190 190
             if ($extension !== '') {
191
-                $service->addImageEnvVariable('PHP_EXTENSION_'.\strtoupper($extension), '1');
191
+                $service->addImageEnvVariable('PHP_EXTENSION_' . \strtoupper($extension), '1');
192 192
                 $extensions[] = $extension;
193 193
             }
194 194
         } while ($extension !== '');
195
-        $this->output->writeln('<info>Enabled extensions: apcu mysqli opcache pdo pdo_mysql redis zip soap mbstring ftp mysqlnd '.\implode(' ', $extensions).'</info>');
195
+        $this->output->writeln('<info>Enabled extensions: apcu mysqli opcache pdo pdo_mysql redis zip soap mbstring ftp mysqlnd ' . \implode(' ', $extensions) . '</info>');
196 196
 
197 197
         /************************ php.ini settings **********************/
198 198
         $this->output->writeln("Now, let's customize some settings of <info>php.ini</info>.");
199 199
 
200 200
         $memoryLimit = $this->getAentHelper()->question('PHP <info>memory limit</info> (keep empty to stay with the default 128M)')
201 201
             ->setHelpText('This value will be used in the memory_limit option of PHP via the PHP_INI_MEMORY_LIMIT environment variable.')
202
-            ->setValidator(function (string $value) {
202
+            ->setValidator(function(string $value) {
203 203
                 if (trim($value) !== '' && !\preg_match('/^\d+([MGK])?$/i', $value)) {
204
-                    throw new \InvalidArgumentException('Invalid value: '.$value);
204
+                    throw new \InvalidArgumentException('Invalid value: ' . $value);
205 205
                 }
206 206
                 return trim($value);
207 207
             })
@@ -213,9 +213,9 @@  discard block
 block discarded – undo
213 213
 
214 214
         $uploadMaxFileSize = $this->getAentHelper()->question('<info>Maximum file size for uploaded files</info> (keep empty to stay with the default 2M)')
215 215
             ->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.')
216
-            ->setValidator(function (string $value) {
216
+            ->setValidator(function(string $value) {
217 217
                 if (trim($value) !== '' && !\preg_match('/^\d+([MGK])?$/i', $value)) {
218
-                    throw new \InvalidArgumentException('Invalid value: '.$value);
218
+                    throw new \InvalidArgumentException('Invalid value: ' . $value);
219 219
                 }
220 220
                 return trim($value);
221 221
             })
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
                 ->ask();
236 236
             if ($depend !== '') {
237 237
                 $service->addDependsOn($depend);
238
-                $this->output->writeln('<info>Added dependency: '.$depend.'</info>');
238
+                $this->output->writeln('<info>Added dependency: ' . $depend . '</info>');
239 239
             }
240 240
         } while ($depend !== '');
241 241
         
Please login to merge, or discard this patch.