mirror of
https://github.com/Dannecron/test-php8-attributes.git
synced 2025-12-25 21:32:35 +03:00
initial commit
This commit is contained in:
26
src/Command/JokeCommand.php
Normal file
26
src/Command/JokeCommand.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Command;
|
||||
|
||||
use App\Operation\JokeOperation;
|
||||
|
||||
class JokeCommand extends \Ahc\Cli\Input\Command
|
||||
{
|
||||
private JokeOperation $jokeOperation;
|
||||
|
||||
public function __construct(JokeOperation $jokeOperation)
|
||||
{
|
||||
parent::__construct('joke', 'Get some joke');
|
||||
|
||||
$this->jokeOperation = $jokeOperation;
|
||||
}
|
||||
|
||||
public function execute(): void
|
||||
{
|
||||
$io = $this->app()->io();
|
||||
$joke = $this->jokeOperation->getRandomJoke();
|
||||
$io->green($joke, true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user