Blame view
app/Console/SymfonyCommandIntegrator.php
1011 Bytes
e77200db5 Initial commit |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
<?php namespace FootyRoom\Console; use Symfony\Component\Console\Helper\HelperInterface; trait SymfonyCommandIntegrator { public function __construct() { $this->originalCommand = new $this->symfonyCommand(); $this->name = $this->originalCommand->getName(); $this->description = $this->originalCommand->getDescription(); $this->hidden = $this->originalCommand->isHidden(); parent::__construct(); $this->setHelp($this->originalCommand->getHelp()); $this->setDefinition($this->originalCommand->getDefinition()); } protected function executeSymfonyCommand(): ?int { $this->originalCommand->setApplication($this->getApplication()); return $this->originalCommand->execute($this->input, $this->output); } protected function setHelper(string $key, HelperInterface $value): void { $helperSet = $this->getApplication()->getHelperSet(); $helperSet->set($value, $key); } } |