|
|
@ -2,6 +2,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
namespace jrosset\CliProgram;
|
|
|
|
namespace jrosset\CliProgram;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use jrosset\Collections\Collection;
|
|
|
|
|
|
|
|
use jrosset\Collections\ICollection;
|
|
|
|
use Symfony\Component\Console\Command\Command;
|
|
|
|
use Symfony\Component\Console\Command\Command;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -9,43 +11,20 @@ use Symfony\Component\Console\Command\Command;
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
trait TAutoPrefixManagement {
|
|
|
|
trait TAutoPrefixManagement {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @var IAutoPrefixManager[] The lists of manager for commands auto prefix
|
|
|
|
* @var ICollection<IAutoPrefixManager> The lists of manager for commands auto prefix
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private array $autoPrefixManagers;
|
|
|
|
private ICollection $autoPrefixManagers;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* The lists of manager for commands auto prefix
|
|
|
|
* The lists of manager for commands auto prefix
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return IAutoPrefixManager[] The lists of manager for commands auto prefix
|
|
|
|
* @return ICollection<IAutoPrefixManager> The lists of manager for commands auto prefix
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function getAutoPrefixManagers (): array {
|
|
|
|
public function getAutoPrefixManagers (): ICollection {
|
|
|
|
return $this->autoPrefixManagers;
|
|
|
|
if (!isset($this->autoPrefixManagers)) {
|
|
|
|
}
|
|
|
|
$this->autoPrefixManagers = new Collection();
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Set The lists of manager for commands auto prefix
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param IAutoPrefixManager[] $autoPrefixManagers The lists of manager for commands auto prefix
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return $this
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public function setAutoPrefixManagers (array $autoPrefixManagers): self {
|
|
|
|
|
|
|
|
$this->autoPrefixManagers = $autoPrefixManagers;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Add a manager for commands auto prefix
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param IAutoPrefixManager $manager The manager
|
|
|
|
|
|
|
|
* @param IAutoPrefixManager ...$extraManagers Extra managers to add
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return $this
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public function addAutoPrefixManagers (IAutoPrefixManager $manager, IAutoPrefixManager ...$extraManagers): self {
|
|
|
|
|
|
|
|
$this->autoPrefixManagers[] = $manager;
|
|
|
|
|
|
|
|
foreach ($extraManagers as $extraNamespace) {
|
|
|
|
|
|
|
|
$this->autoPrefixManagers[] = $extraNamespace;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this;
|
|
|
|
return $this->autoPrefixManagers;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|