Newer
Older
<?php
namespace App\Command;
use App\Application;
use App\Concerns\WritesToConsole;
use GetOpt\Command;
use GetOpt\GetOpt;
use GetOpt\Option;
use Hugga\Console;
abstract class AbstractCommand extends Command
{
use WritesToConsole;
/** @var string */
protected $name = 'unnamed';
/** @var string */
protected $description = '';
/** @var Application */
protected $app;
public function __construct(Application $app, Console $console)
{
$this->app = $app;
$this->console = $console;
parent::__construct($this->name, [$this, 'handle']);
if (!empty($this->description)) {
$this->setDescription($this->description);
}
}
abstract public function handle(GetOpt $getOpt): int;
}