4 use Robo\Common\InflectionTrait;
5 use Robo\Contract\InflectionInterface;
7 use Robo\Common\TaskIO;
8 use Robo\Contract\TaskInterface;
9 use Robo\Contract\ProgressIndicatorAwareInterface;
10 use Robo\Contract\VerbosityThresholdInterface;
11 use Robo\Common\ProgressIndicatorAwareTrait;
12 use Robo\Contract\ConfigAwareInterface;
13 use Psr\Log\LoggerAwareInterface;
14 use Robo\Contract\OutputAwareInterface;
16 abstract class BaseTask implements TaskInterface, LoggerAwareInterface, VerbosityThresholdInterface, ConfigAwareInterface, ProgressIndicatorAwareInterface, InflectionInterface
18 use TaskIO; // uses LoggerAwareTrait, VerbosityThresholdTrait and ConfigAwareTrait
19 use ProgressIndicatorAwareTrait;
23 * ConfigAwareInterface uses this to decide where configuration
24 * items come from. Default is this prefix + class name + key,
25 * e.g. `task.Remote.Ssh.remoteDir`.
27 protected static function configPrefix()
33 * ConfigAwareInterface uses this to decide where configuration
34 * items come from. Default is this prefix + class name + key,
35 * e.g. `task.Ssh.remoteDir`.
37 protected static function configPostfix()
45 public function injectDependencies(InflectionInterface $child)
47 if ($child instanceof LoggerAwareInterface && $this->logger) {
48 $child->setLogger($this->logger);
50 if ($child instanceof ProgressIndicatorAwareInterface && $this->progressIndicator) {
51 $child->setProgressIndicator($this->progressIndicator);
53 if ($child instanceof ConfigAwareInterface && $this->getConfig()) {
54 $child->setConfig($this->getConfig());
56 if ($child instanceof VerbosityThresholdInterface && $this->outputAdapter()) {
57 $child->setOutputAdapter($this->outputAdapter());