| Conditions | 4 |
| Paths | 2 |
| Total Lines | 26 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 17 |
| CRAP Score | 4.0027 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | 3 | public function process(SymfonyStyle $io, CustomizableAppConfig $appConfig) |
|
| 18 | { |
||
| 19 | 3 | $io->title('URL SHORTENER'); |
|
| 20 | |||
| 21 | 3 | if ($appConfig->hasUrlShortener() && $io->confirm('Do you want to keep imported URL shortener config?')) { |
|
| 22 | 1 | return; |
|
| 23 | } |
||
| 24 | |||
| 25 | // Ask for URL shortener params |
||
| 26 | 2 | $appConfig->setUrlShortener([ |
|
| 27 | 2 | 'SCHEMA' => $io->choice( |
|
| 28 | 2 | 'Select schema for generated short URLs', |
|
| 29 | 2 | ['http', 'https'], |
|
| 30 | 2 | 'http' |
|
| 31 | ), |
||
| 32 | 2 | 'HOSTNAME' => $io->ask('Hostname for generated URLs'), |
|
| 33 | 2 | 'CHARS' => $io->ask( |
|
| 34 | 2 | 'Character set for generated short codes (leave empty to autogenerate one)', |
|
| 35 | 2 | null, |
|
| 36 | function ($value) { |
||
| 37 | return $value; |
||
| 38 | 2 | } |
|
| 39 | 2 | ) ?: \str_shuffle(UrlShortener::DEFAULT_CHARS), |
|
| 40 | 2 | 'VALIDATE_URL' => $io->confirm('Do you want to validate long urls by 200 HTTP status code on response'), |
|
| 41 | ]); |
||
| 42 | 2 | } |
|
| 43 | } |
||
| 44 |