コード例 #1
0
ファイル: Command.php プロジェクト: beingsane/quickcontent
 /**
  * Console constructor.
  *
  * @param   string           $name    Console name.
  * @param   Input\Cli        $input   Cli input object.
  * @param   CliOutput        $output  Cli output object.
  * @param   AbstractCommand  $parent  Parent Console.
  *
  * @throws  \LogicException
  */
 public function __construct($name = null, Input\Cli $input = null, CliOutput $output = null, AbstractCommand $parent = null)
 {
     $this->globalOptions = OptionSet::getInstance();
     parent::__construct($name, $input, $output, $parent);
     $ref = new \ReflectionClass($this);
     // Register sub commands
     $dirs = new \DirectoryIterator(dirname($ref->getFileName()));
     foreach ($dirs as $dir) {
         if (!$dir->isDir() || $dirs->isDot()) {
             continue;
         }
         $name = ucfirst($dir->getBasename());
         $class = $ref->getNamespaceName() . '\\' . $name . "\\" . $name . 'Command';
         if (class_exists($class) && $class::$isEnabled) {
             $this->addCommand(new $class());
         }
     }
 }
コード例 #2
0
 /**
  * Test the err method.
  *
  * @return void
  *
  * @since  1.0
  *
  * @covers Joomla\Console\Command\AbstractCommand::err
  */
 public function testErr()
 {
     $this->instance->getOutput()->setOutput('');
     $this->instance->err('errrr', false);
     $this->assertEquals('errrr', $this->instance->getOutput()->getOutput());
 }
コード例 #3
0
ファイル: Controller.php プロジェクト: beingsane/quickcontent
 /**
  * Get a value from standard input.
  *
  * @param   string  $question  The question you want to ask user.
  *
  * @return  string  The input string from standard input.
  *
  * @since   1.0
  */
 public function in($question = '')
 {
     return $this->command->in($question);
 }