Completed
Push — master ( 9309af...2f23a4 )
by Jindun
10s
created
src/Command/AddEventCommand.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         if ($node === 'No') {
83 83
             $node = '';
84 84
         } else {
85
-            $node = '-'.$node;
85
+            $node = '-' . $node;
86 86
         }
87 87
 
88 88
         $service->setImage("thecodingmachine/php:$phpVersion-v1-$variant$node");
@@ -93,22 +93,22 @@  discard block
 block discarded – undo
93 93
         $this->output->writeln('Now, we need to find the root of your web application.');
94 94
         $appDirectory = $aentHelper->question('PHP application root directory (relative to the project root directory)')
95 95
             ->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.')
96
-            ->setValidator(function (string $appDirectory) {
96
+            ->setValidator(function(string $appDirectory) {
97 97
                 $appDirectory = trim($appDirectory, '/') ?: '.';
98 98
                 $rootDir = Pheromone::getContainerProjectDirectory();
99 99
 
100
-                $fullDir = $rootDir.'/'.$appDirectory;
100
+                $fullDir = $rootDir . '/' . $appDirectory;
101 101
                 if (!is_dir($fullDir)) {
102
-                    throw new \InvalidArgumentException('Could not find directory '.Pheromone::getHostProjectDirectory().'/'.$appDirectory);
102
+                    throw new \InvalidArgumentException('Could not find directory ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory);
103 103
                 }
104 104
                 return $appDirectory;
105 105
             })->ask();
106 106
 
107
-        $this->output->writeln('<info>Your root PHP application directory is '.Pheromone::getHostProjectDirectory().'/'.$appDirectory.'</info>');
107
+        $this->output->writeln('<info>Your root PHP application directory is ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . '</info>');
108 108
         $aentHelper->spacer();
109 109
         $aentHelper->spacer();
110 110
 
111
-        $service->addBindVolume('./'.$appDirectory, '/var/www/html');
111
+        $service->addBindVolume('./' . $appDirectory, '/var/www/html');
112 112
 
113 113
         /************************ Web application path **********************/
114 114
         $webDirectory = null;
@@ -117,20 +117,20 @@  discard block
 block discarded – undo
117 117
                 ->yesNoQuestion()->setDefault('y')->ask();
118 118
             if ($answer) {
119 119
                 $webDirectory = $aentHelper->question('Web directory (relative to the PHP application directory)')
120
-                    ->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.')')
121
-                    ->setValidator(function (string $webDirectory) use ($appDirectory) {
120
+                    ->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 . ')')
121
+                    ->setValidator(function(string $webDirectory) use ($appDirectory) {
122 122
                         $webDirectory = trim($webDirectory, '/') ?: '.';
123 123
                         $rootDir = Pheromone::getContainerProjectDirectory();
124 124
 
125
-                        $fullDir = $rootDir.'/'.$appDirectory.'/'.$webDirectory;
125
+                        $fullDir = $rootDir . '/' . $appDirectory . '/' . $webDirectory;
126 126
                         if (!is_dir($fullDir)) {
127
-                            throw new \InvalidArgumentException('Could not find directory '.Pheromone::getHostProjectDirectory().'/'.$appDirectory.'/'.$webDirectory);
127
+                            throw new \InvalidArgumentException('Could not find directory ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . '/' . $webDirectory);
128 128
                         }
129 129
                         return $webDirectory;
130 130
                     })->ask();
131 131
 
132 132
                 $service->addImageEnvVariable('APACHE_DOCUMENT_ROOT', $webDirectory);
133
-                $this->output->writeln('<info>Your web directory is '.Pheromone::getHostProjectDirectory().'/'.$appDirectory.'/'.$webDirectory.'</info>');
133
+                $this->output->writeln('<info>Your web directory is ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . '/' . $webDirectory . '</info>');
134 134
                 $aentHelper->spacer();
135 135
                 $aentHelper->spacer();
136 136
             }
@@ -151,26 +151,26 @@  discard block
 block discarded – undo
151 151
             $rootDir = Pheromone::getContainerProjectDirectory();
152 152
 
153 153
             if ($uploadDirectory !== '') {
154
-                $fullDir = $rootDir.'/'.$appDirectory.'/'.$uploadDirectory;
154
+                $fullDir = $rootDir . '/' . $appDirectory . '/' . $uploadDirectory;
155 155
                 if (!is_dir($fullDir)) {
156
-                    $this->output->writeln('<error>Could not find directory '.Pheromone::getHostProjectDirectory().'/'.$appDirectory.'/'.$uploadDirectory.'</error>');
156
+                    $this->output->writeln('<error>Could not find directory ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . '/' . $uploadDirectory . '</error>');
157 157
                     $uploadDirectory = null;
158 158
                 } else {
159 159
                     $uploadDirs[] = $uploadDirectory;
160
-                    $this->output->writeln('<info>Directory '.Pheromone::getHostProjectDirectory().'/'.$appDirectory.'/'.$uploadDirectory.' will be stored out of the container</info>');
160
+                    $this->output->writeln('<info>Directory ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . '/' . $uploadDirectory . ' will be stored out of the container</info>');
161 161
 
162 162
                     $question = new Question('What name should we use for this volume? ', '');
163
-                    $question->setValidator(function (string $value) {
163
+                    $question->setValidator(function(string $value) {
164 164
                         $value = trim($value);
165 165
                         if (!\preg_match('/^[a-zA-Z0-9_.-]+$/', $value)) {
166
-                            throw new \InvalidArgumentException('Invalid volume name "'.$value.'". Volume names can contain alphanumeric characters, and "_", ".", "-".');
166
+                            throw new \InvalidArgumentException('Invalid volume name "' . $value . '". Volume names can contain alphanumeric characters, and "_", ".", "-".');
167 167
                         }
168 168
 
169 169
                         return $value;
170 170
                     });
171 171
                     $volumeName = $helper->ask($this->input, $this->output, $question);
172 172
 
173
-                    $service->addNamedVolume($volumeName, $appDirectory.'/'.$uploadDirectory);
173
+                    $service->addNamedVolume($volumeName, $appDirectory . '/' . $uploadDirectory);
174 174
                 }
175 175
             }
176 176
         } while ($uploadDirectory !== '');
@@ -185,16 +185,16 @@  discard block
 block discarded – undo
185 185
         $this->output->writeln('By default, the following extensions are enabled:');
186 186
         $this->output->writeln('<info>apcu mysqli opcache pdo pdo_mysql redis zip soap mbstring ftp mysqlnd</info>');
187 187
         $this->output->writeln('You can select more extensions below:');
188
-        $this->output->writeln('<info>'.\implode(' ', $availableExtensions).'</info>');
188
+        $this->output->writeln('<info>' . \implode(' ', $availableExtensions) . '</info>');
189 189
 
190 190
         /************************ Extensions **********************/
191 191
         $extensions = [];
192 192
         do {
193 193
             $question = new Question('Please enter the name of an additional extension you want to install (keep empty to skip): ', '');
194 194
             $question->setAutocompleterValues($availableExtensions);
195
-            $question->setValidator(function (string $value) use ($availableExtensions) {
195
+            $question->setValidator(function(string $value) use ($availableExtensions) {
196 196
                 if (trim($value) !== '' && !\in_array($value, $availableExtensions)) {
197
-                    throw new \InvalidArgumentException('Unknown extension '.$value);
197
+                    throw new \InvalidArgumentException('Unknown extension ' . $value);
198 198
                 }
199 199
 
200 200
                 return trim($value);
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
             $extension = $helper->ask($this->input, $this->output, $question);
204 204
 
205 205
             if ($extension !== '') {
206
-                $service->addImageEnvVariable('PHP_EXTENSION_'.\strtoupper($extension), '1');
206
+                $service->addImageEnvVariable('PHP_EXTENSION_' . \strtoupper($extension), '1');
207 207
                 $extensions[] = $extension;
208 208
             }
209 209
         } while ($extension !== '');
210
-        $this->output->writeln('<info>Enabled extensions: apcu mysqli opcache pdo pdo_mysql redis zip soap mbstring ftp mysqlnd '.\implode(' ', $extensions).'</info>');
210
+        $this->output->writeln('<info>Enabled extensions: apcu mysqli opcache pdo pdo_mysql redis zip soap mbstring ftp mysqlnd ' . \implode(' ', $extensions) . '</info>');
211 211
         $aentHelper->spacer();
212 212
         $aentHelper->spacer();
213 213
 
@@ -217,9 +217,9 @@  discard block
 block discarded – undo
217 217
 
218 218
         $memoryLimit = $aentHelper->question('PHP <info>memory limit</info> (keep empty to stay with the default 128M)')
219 219
             ->setHelpText('This value will be used in the memory_limit option of PHP via the PHP_INI_MEMORY_LIMIT environment variable.')
220
-            ->setValidator(function (string $value) {
220
+            ->setValidator(function(string $value) {
221 221
                 if (trim($value) !== '' && !\preg_match('/^[0-9]+([MGK])?$/i', $value)) {
222
-                    throw new \InvalidArgumentException('Invalid value: '.$value);
222
+                    throw new \InvalidArgumentException('Invalid value: ' . $value);
223 223
                 }
224 224
 
225 225
                 return trim($value);
@@ -232,9 +232,9 @@  discard block
 block discarded – undo
232 232
 
233 233
         $uploadMaxFileSize = $aentHelper->question('<info>Maximum file size for uploaded files</info> (keep empty to stay with the default 2M)')
234 234
             ->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.')
235
-            ->setValidator(function (string $value) {
235
+            ->setValidator(function(string $value) {
236 236
                 if (trim($value) !== '' && !\preg_match('/^[0-9]+([MGK])?$/i', $value)) {
237
-                    throw new \InvalidArgumentException('Invalid value: '.$value);
237
+                    throw new \InvalidArgumentException('Invalid value: ' . $value);
238 238
                 }
239 239
 
240 240
                 return trim($value);
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 
258 258
             if ($depend !== '') {
259 259
                 $service->addDependsOn($depend);
260
-                $this->output->writeln('<info>Added dependency: '.$depend.'</info>');
260
+                $this->output->writeln('<info>Added dependency: ' . $depend . '</info>');
261 261
             }
262 262
         } while ($depend !== '');
263 263
         $aentHelper->spacer();
Please login to merge, or discard this patch.