forked from fa/breadcrumb-the-shire
28 lines
711 B
PHP
28 lines
711 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace MintyPHP\Console\Commands\Module;
|
||
|
|
|
||
|
|
use MintyPHP\Console\Command;
|
||
|
|
use MintyPHP\Console\Runner\Module\ModuleRunner;
|
||
|
|
use MintyPHP\Console\Runner\Module\ModuleRunnerInterface;
|
||
|
|
|
||
|
|
abstract class AbstractModuleCommand extends Command
|
||
|
|
{
|
||
|
|
private ?ModuleRunnerInterface $moduleRunner;
|
||
|
|
|
||
|
|
public function __construct(?ModuleRunnerInterface $moduleRunner = null)
|
||
|
|
{
|
||
|
|
$this->moduleRunner = $moduleRunner;
|
||
|
|
}
|
||
|
|
|
||
|
|
protected function moduleRunner(): ModuleRunnerInterface
|
||
|
|
{
|
||
|
|
if ($this->moduleRunner instanceof ModuleRunnerInterface) {
|
||
|
|
return $this->moduleRunner;
|
||
|
|
}
|
||
|
|
|
||
|
|
$this->moduleRunner = new ModuleRunner();
|
||
|
|
return $this->moduleRunner;
|
||
|
|
}
|
||
|
|
}
|