Skip to content

Commit

Permalink
[console] Add and initialize io DrupalStyle property. (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmolivas committed Dec 31, 2017
1 parent 23383af commit 1caa7a1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
23 changes: 23 additions & 0 deletions src/Command/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
namespace Drupal\Console\Core\Command;

use Symfony\Component\Console\Command\Command as BaseCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Drupal\Console\Core\Command\Shared\CommandTrait;
use Drupal\Console\Core\Style\DrupalStyle;

/**
* Class Command
Expand All @@ -17,4 +20,24 @@
abstract class Command extends BaseCommand
{
use CommandTrait;

/**
* @var DrupalStyle
*/
protected $io;

/**
* {@inheritdoc}
*/
protected function initialize(InputInterface $input, OutputInterface $output)
{
$this->io = new DrupalStyle($input, $output);
}

/**
* @return \Drupal\Console\Core\Style\DrupalStyle
*/
public function getIo() {
return $this->io;
}
}
3 changes: 1 addition & 2 deletions src/Command/ContainerAwareCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@

namespace Drupal\Console\Core\Command;

use Symfony\Component\Console\Command\Command as BaseCommand;
use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait;

/**
* Class ContainerAwareCommand
* @package Drupal\Console\Core\Command
*/
abstract class ContainerAwareCommand extends BaseCommand
abstract class ContainerAwareCommand extends Command
{
use ContainerAwareCommandTrait;
}

0 comments on commit 1caa7a1

Please sign in to comment.