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