Skip to content

Commit bd8acb1

Browse files
authored
Cubex aware commands (#46)
1 parent c4cd6e9 commit bd8acb1

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/Console/Console.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
namespace Cubex\Console;
33

44
use Cubex\Console\Commands\BuiltInWebServer;
5+
use Cubex\CubexAware;
56
use Cubex\CubexAwareTrait;
67
use Packaged\Config\ConfigProviderInterface;
78
use Packaged\Context\ContextAware;
@@ -129,6 +130,11 @@ protected function _prepareCommand(Command $command): Command
129130
{
130131
$command->setContext($this->getContext());
131132
}
133+
134+
if($this->hasCubex() && $command instanceof CubexAware)
135+
{
136+
$command->setCubex($this->getCubex());
137+
}
132138
return $command;
133139
}
134140

src/Console/ConsoleCommand.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22
namespace Cubex\Console;
33

4+
use Cubex\CubexAware;
5+
use Cubex\CubexAwareTrait;
46
use Packaged\Context\ContextAware;
57
use Packaged\Context\ContextAwareTrait;
68
use Packaged\DocBlock\DocBlockParser;
@@ -23,9 +25,10 @@
2325
/**
2426
* Extended Command to support public properties for arguments
2527
*/
26-
abstract class ConsoleCommand extends Command implements ContextAware
28+
abstract class ConsoleCommand extends Command implements ContextAware, CubexAware
2729
{
2830
use ContextAwareTrait;
31+
use CubexAwareTrait;
2932

3033
/**
3134
* @var InputInterface

0 commit comments

Comments
 (0)