Ejemplo n.º 1
0
 /**
  * {inheritdoc}
  */
 public function injectDependencies(InflectionInterface $child)
 {
     if ($child instanceof LoggerAwareInterface && $this->logger) {
         $child->setLogger($this->logger);
     }
     if ($child instanceof ProgressIndicatorAwareInterface && $this->progressIndicator) {
         $child->setProgressIndicator($this->progressIndicator);
     }
     if ($child instanceof ConfigAwareInterface && $this->getConfig()) {
         $child->setConfig($this->getConfig());
     }
 }
Ejemplo n.º 2
0
 /**
  * @param InflectionInterface $task
  * @param array $args
  *
  * @return \Robo\Collection\CompletionWrapper|\Robo\Task\Simulator
  */
 protected function fixTask($task, $args)
 {
     $task->inflect($this);
     if ($task instanceof BuilderAwareInterface) {
         $task->setBuilder($this);
     }
     // Do not wrap our wrappers.
     if ($task instanceof CompletionWrapper || $task instanceof Simulator) {
         return $task;
     }
     // Remember whether or not this is a task before
     // it gets wrapped in any decorator.
     $isTask = $task instanceof TaskInterface;
     $isCollection = $task instanceof NestedCollectionInterface;
     // If the task implements CompletionInterface, ensure
     // that its 'complete' method is called when the application
     // terminates -- but only if its 'run' method is called
     // first.  If the task is added to a collection, then the
     // task will be unwrapped via its `original` method, and
     // it will be re-wrapped with a new completion wrapper for
     // its new collection.
     if ($task instanceof CompletionInterface) {
         $task = new CompletionWrapper(Temporary::getCollection(), $task);
     }
     // If we are in simulated mode, then wrap any task in
     // a TaskSimulator.
     if ($isTask && !$isCollection && $this->isSimulated()) {
         $task = new \Robo\Task\Simulator($task, $args);
         $task->inflect($this);
     }
     return $task;
 }
Ejemplo n.º 3
0
 /**
  * Ask the provided parent class to inject all of the dependencies
  * that it has and we need.
  *
  * @param InflectionInterface $parent
  */
 public function inflect(InflectionInterface $parent)
 {
     $parent->injectDependencies($this);
     return $this;
 }