Interface and Abstract class for Generators
This commit is contained in:
9
app/src/Concept/Generator.php
Normal file
9
app/src/Concept/Generator.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
namespace ProVM\Concept;
|
||||
|
||||
use Symfony\Component\Console\Style\StyleInterface;
|
||||
|
||||
interface Generator
|
||||
{
|
||||
public function generate(StyleInterface $io, bool $dryRun = false): void;
|
||||
}
|
19
app/src/Enforce/Generator.php
Normal file
19
app/src/Enforce/Generator.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
namespace ProVM\Enforce;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\Style\StyleInterface;
|
||||
use ProVM\Concept;
|
||||
|
||||
abstract class Generator implements Concept\Generator
|
||||
{
|
||||
public function __construct(protected LoggerInterface $logger) {}
|
||||
|
||||
protected function log(string $message, bool $output = false, ?StyleInterface $io = null): void
|
||||
{
|
||||
$this->logger->info($message);
|
||||
if ($output) {
|
||||
$io->note($message);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user