Conditions | 4 |
Paths | 4 |
Total Lines | 21 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | 9 | public function ask(string $installationPath): string |
|
24 | { |
||
25 | do { |
||
26 | 9 | $isValidInstallationPath = $this->io->askConfirmation( |
|
27 | 9 | sprintf( |
|
28 | 9 | 'The application will be installed at "<info>%s</info>" directory [<info>Y</info>/N]: ', |
|
29 | 9 | $installationPath |
|
30 | ), |
||
31 | 9 | $this->defaultAnswer |
|
32 | ); |
||
33 | 9 | if (false === $isValidInstallationPath) { |
|
34 | 5 | $installationPath = trim($this->io->ask( |
|
35 | 5 | 'Add the absolute path to install the project [<info>/opt/app</info>]: ', |
|
36 | 5 | '/opt/app' |
|
37 | )); |
||
38 | } |
||
39 | 9 | } while (false === $isValidInstallationPath); |
|
40 | |||
41 | 9 | return substr($installationPath, -1) === '/' |
|
42 | 4 | ? substr($installationPath, 0, -1) |
|
43 | 9 | : $installationPath; |
|
44 | } |
||
46 |