Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 11 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| LogForAnHourCommand | |
0.00% |
0 / 11 |
|
0.00% |
0 / 2 |
20 | |
0.00% |
0 / 1 |
| getAllowedAppEnvs | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| handle | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
12 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Olz\Command; |
| 4 | |
| 5 | use Olz\Command\Common\OlzCommand; |
| 6 | use Symfony\Component\Console\Attribute\AsCommand; |
| 7 | use Symfony\Component\Console\Command\Command; |
| 8 | use Symfony\Component\Console\Input\InputInterface; |
| 9 | use Symfony\Component\Console\Output\OutputInterface; |
| 10 | |
| 11 | #[AsCommand(name: 'olz:log-for-an-hour')] |
| 12 | class LogForAnHourCommand extends OlzCommand { |
| 13 | /** @return array<string> */ |
| 14 | protected function getAllowedAppEnvs(): array { |
| 15 | return ['dev', 'test', 'staging', 'prod']; |
| 16 | } |
| 17 | |
| 18 | protected function handle(InputInterface $input, OutputInterface $output): int { |
| 19 | $success = set_time_limit(4000); |
| 20 | if ($success) { |
| 21 | $this->log()->info("Successfully set time limit"); |
| 22 | } else { |
| 23 | $this->log()->warning("Could not set time limit. Let's hope for the best :/"); |
| 24 | } |
| 25 | for ($i = 0; $i < 360; $i++) { |
| 26 | $time = $this->dateUtils()->getCurrentDateInFormat('H:i:s'); |
| 27 | $this->log()->info("It is {$time}"); |
| 28 | sleep(10); |
| 29 | } |
| 30 | $this->log()->info("Successfully wasted an hour!"); |
| 31 | |
| 32 | return Command::SUCCESS; |
| 33 | } |
| 34 | } |