improve the command
This commit is contained in:
parent
bdb92142d9
commit
f32fdcdcc5
|
@ -14,7 +14,7 @@ $ composer install
|
|||
```
|
||||
|
||||
```
|
||||
$ php7.3 ./domain-expiration check example.com,other-example.com
|
||||
$ php7.3 ./domain-expiration check example.com other-example.com
|
||||
+------------------------+---------------------+
|
||||
| Domain | Date |
|
||||
+------------------------+---------------------+
|
||||
|
|
|
@ -44,7 +44,13 @@ class CheckCommand extends BaseCommand
|
|||
{
|
||||
$this
|
||||
->setName('check')
|
||||
->addArgument('domains', InputArgument::REQUIRED, 'List of domains separated by commas');
|
||||
->addArgument('domains', InputArgument::IS_ARRAY|InputArgument::REQUIRED, 'List of domains.')
|
||||
->setHelp(<<<EOF
|
||||
The <info>%command.name%</info> retrieves the expiration dates of the given domains.
|
||||
|
||||
Example: %command.full_name% example.com other-example.com
|
||||
EOF
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,8 +90,15 @@ class CheckCommand extends BaseCommand
|
|||
*/
|
||||
protected function getDomains():array
|
||||
{
|
||||
$domains = explode(',', $this->input->getArgument('domains'));
|
||||
$domains = array_map('trim', $domains);
|
||||
$inputDomains = $this->input->getArgument('domains');
|
||||
$domains = [];
|
||||
|
||||
foreach ($inputDomains as $inputDomain) {
|
||||
$value = explode(',', $inputDomain);
|
||||
$value = array_map('trim', $value);
|
||||
|
||||
$domains = array_merge($value, $domains);
|
||||
}
|
||||
|
||||
return $domains;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue