Compare commits

..

No commits in common. "2e6c1b4ca36910d99d65781da64f03bbfe7a2a42" and "c5842b4f55c779118898c02241ea5b0aa3260190" have entirely different histories.

15 changed files with 281 additions and 229 deletions

View file

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2019 Marvin Schreurs Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View file

@ -1,6 +1,3 @@
# Console Writer # laravel-output-writer
Console input/output writer for Symfony. Features a dedicated class for console Console output interface for laravel.
interactivity based on Symfony's Console component, allowing
easier styling through proper class inheritance while providing a simple and
non-obstructive interface for use in your console commands.

View file

@ -1,31 +0,0 @@
{
"name": "danmaku/console-writer",
"type": "library",
"description": "Easily adaptable console input/output writer for Symfony.",
"authors": [
{
"name": "Marvin Schreurs",
"email": "fristi@danmaku.moe",
"homepage": "https://fristi.danmaku.moe",
"role": "Developer"
}
],
"support": {
"email": "fristi@danmaku.moe"
},
"keywords": [
"console",
"symfony"
],
"license": "MIT",
"minimum-stability": "dev",
"require": {
"php": ">=7.2.0",
"symfony/console": "^4.2"
},
"autoload": {
"psr-4": {
"Danmaku\\Console\\": "src/Console"
}
}
}

View file

@ -0,0 +1,54 @@
<?php
/**
* BaseCommand class source file.
*
* Contains the source code of the BaseCommand class.
*
* PHP version 7.2
*
* @package Arc\Base\Console\Command
* @author Marvin Schreurs <m.schreurs@archimedetrading.eu>
*/
namespace Arc\Base\Console\Command;
use Arc\Base\Console\Output\BaseOutputWriter;
use Arc\Base\Console\Output\OutputWriterInterface;
use Illuminate\Console\Command;
use Illuminate\Console\OutputStyle;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Class BaseCommand
*
* @package Arc\Base\Console\Command
* @author Marvin Schreurs <m.schreurs@archimedetrading.eu>
*/
abstract class BaseCommand extends Command
{
/**
* OutputWriterInterface instance.
*
* @var OutputWriterInterface $writer
*/
protected $writer;
/**
* @inheritDoc
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->setOutputWriter($input, $output);
return parent::execute($input, $output);
}
/**
* Set the output writer to use with this command.
*/
protected function setOutputWriter(InputInterface $input, OutputInterface $output): void
{
$this->writer = new BaseOutputWriter($input, $output);
}
}

View file

@ -6,11 +6,11 @@
* *
* PHP version 7.2 * PHP version 7.2
* *
* @package Danmaku\Console\Helper * @package Arc\Base\Console\Helper
* @author Marvin Schreurs <fristi@danmaku.moe> * @author Marvin Schreurs <m.schreurs@archimedetrading.eu>
*/ */
namespace Danmaku\Console\Helper; namespace Arc\Base\Console\Helper;
use Symfony\Component\Console\Exception\RuntimeException; use Symfony\Component\Console\Exception\RuntimeException;
@ -28,10 +28,10 @@ use Symfony\Component\Console\Style\SymfonyStyle;
/** /**
* Class QuestionHelper * Class QuestionHelper
* *
* @package Danmaku\Console\Helper * @package Arc\Base\Console\Helper
* @author Marvin Schreurs <fristi@danmaku.moe> * @author Marvin Schreurs <m.schreurs@archimedetrading.eu>
*/ */
class QuestionHelper extends InheritableQuestionHelper class QuestionHelper extends UnfuckedQuestionHelper
{ {
public function ask(InputInterface $input, OutputInterface $output, Question $question) public function ask(InputInterface $input, OutputInterface $output, Question $question)
{ {

View file

@ -1,16 +1,16 @@
<?php <?php
/** /**
* InheritableQuestionHelper class source file. * UnfuckedQuestionHelper class source file.
* *
* Contains the source code of the InheritableQuestionHelper class. * Contains the source code of the UnfuckedQuestionHelper class.
* *
* PHP version 7.2 * PHP version 7.2
* *
* @package Danmaku\Console\Helper * @package Arc\Base\Console\Helper
* @author Marvin Schreurs <fristi@danmaku.moe> * @author Marvin Schreurs <m.schreurs@archimedetrading.eu>
*/ */
namespace Danmaku\Console\Helper; namespace Arc\Base\Console\Helper;
use Symfony\Component\Console\Exception\RuntimeException; use Symfony\Component\Console\Exception\RuntimeException;
@ -25,12 +25,12 @@ use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Console\Question\Question; use Symfony\Component\Console\Question\Question;
/** /**
* Class InheritableQuestionHelper * Class UnfuckedQuestionHelper
* *
* @package Danmaku\Console\Helper * @package Arc\Base\Console\Helper
* @author Marvin Schreurs <fristi@danmaku.moe> * @author Marvin Schreurs <m.schreurs@archimedetrading.eu>
*/ */
class InheritableQuestionHelper extends \Symfony\Component\Console\Helper\QuestionHelper class UnfuckedQuestionHelper extends \Symfony\Component\Console\Helper\QuestionHelper
{ {
protected $inputStream; protected $inputStream;
protected static $shell; protected static $shell;

View file

@ -1,22 +1,22 @@
<?php <?php
/** /**
* DefaultOutputWriter class source file. * BaseOutputWriter class source file.
* *
* Contains the source code of the DefaultOutputWriter class. * Contains the source code of the BaseOutputWriter class.
* *
* PHP version 7.2 * PHP version 7.2
* *
* @package Danmaku\Console\Writer * @package Arc\Base\Console\Output
* @author Marvin Schreurs <fristi@danmaku.moe> * @author Marvin Schreurs <m.schreurs@archimedetrading.eu>
*/ */
namespace Danmaku\Console\Writer; namespace Arc\Base\Console\Output;
use Danmaku\Console\Helper\QuestionHelper; use Arc\Base\Console\Helper\QuestionHelper;
use Danmaku\Console\Question\ChoiceQuestion; use Arc\Base\Console\Question\BaseChoiceQuestion;
use Danmaku\Console\Question\ConfirmationQuestion; use Arc\Base\Console\Question\BaseConfirmationQuestion;
use Danmaku\Console\Question\Question; use Arc\Base\Console\Question\BaseQuestion;
use Symfony\Component\Console\Exception\RuntimeException; use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Formatter\OutputFormatter; use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Formatter\OutputFormatterStyle; use Symfony\Component\Console\Formatter\OutputFormatterStyle;
@ -27,16 +27,18 @@ use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Output\BufferedOutput;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\Question as SymfonyQuestion; use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Console\Question\Question;
use Symfony\Component\Console\Terminal; use Symfony\Component\Console\Terminal;
/** /**
* Class DefaultOutputWriter * Class BaseOutputWriter
* *
* @package Danmaku\Console\Writer * @package Arc\Base\Console\Output
* @author Marvin Schreurs <fristi@danmaku.moe> * @author Marvin Schreurs <m.schreurs@archimedetrading.eu>
*/ */
class DefaultOutputWriter implements OutputWriterInterface class BaseOutputWriter implements OutputWriterInterface
{ {
/** /**
* Console input interface. * Console input interface.
@ -91,13 +93,11 @@ class DefaultOutputWriter implements OutputWriterInterface
'warning' => ['yellow', 'black'], 'warning' => ['yellow', 'black'],
'danger' => ['red', 'black'], 'danger' => ['red', 'black'],
'success' => ['green', 'black'], 'success' => ['green', 'black'],
'debug' => ['black', 'white'],
'comment-bg' => ['black', 'white'], 'comment-bg' => ['black', 'white'],
'info-bg' => ['black', 'cyan'], 'info-bg' => ['black', 'cyan'],
'warning-bg' => ['black', 'yellow'], 'warning-bg' => ['black', 'yellow'],
'danger-bg' => ['white', 'red'], 'danger-bg' => ['white', 'red'],
'success-bg' => ['black', 'green'], 'success-bg' => ['black', 'green'],
'debug-bg' => ['black', 'white'],
'title' => ['green', 'black'], 'title' => ['green', 'black'],
'section' => ['white', 'black'], 'section' => ['white', 'black'],
'question'=> ['green', 'black'], 'question'=> ['green', 'black'],
@ -110,7 +110,7 @@ class DefaultOutputWriter implements OutputWriterInterface
* *
* @var int $maxLineLength * @var int $maxLineLength
*/ */
protected $maxLineLength = 120; protected $maxLineLength = 80;
/** /**
* BaseOutputStyler constructor. * BaseOutputStyler constructor.
@ -136,6 +136,9 @@ class DefaultOutputWriter implements OutputWriterInterface
$this->lineLength = min($width - (int) (\DIRECTORY_SEPARATOR === '\\'), $this->maxLineLength); $this->lineLength = min($width - (int) (\DIRECTORY_SEPARATOR === '\\'), $this->maxLineLength);
} }
/**
* {@inheritdoc}
*/
public function title(string $title): void public function title(string $title): void
{ {
$this->autoPrependBlock(); $this->autoPrependBlock();
@ -146,6 +149,9 @@ class DefaultOutputWriter implements OutputWriterInterface
$this->newLine(); $this->newLine();
} }
/**
* {@inheritdoc}
*/
public function section(string $heading): void public function section(string $heading): void
{ {
$this->autoPrependBlock(); $this->autoPrependBlock();
@ -156,6 +162,9 @@ class DefaultOutputWriter implements OutputWriterInterface
$this->newLine(); $this->newLine();
} }
/**
* {@inheritdoc}
*/
public function table(array $headers, array $rows): void public function table(array $headers, array $rows): void
{ {
$style = clone Table::getStyleDefinition('symfony-style-guide'); $style = clone Table::getStyleDefinition('symfony-style-guide');
@ -170,6 +179,9 @@ class DefaultOutputWriter implements OutputWriterInterface
$this->newLine(); $this->newLine();
} }
/**
* {@inheritdoc}
*/
public function list(array $items, bool $dictionary = false): void public function list(array $items, bool $dictionary = false): void
{ {
$this->autoPrependText(); $this->autoPrependText();
@ -193,7 +205,10 @@ class DefaultOutputWriter implements OutputWriterInterface
$this->newLine(); $this->newLine();
} }
public function text($message, string $style = null, $verbosity = OutputInterface::VERBOSITY_NORMAL): void /**
* {@inheritdoc}
*/
public function text($message, string $style = null): void
{ {
$this->autoPrependText(); $this->autoPrependText();
@ -203,78 +218,85 @@ class DefaultOutputWriter implements OutputWriterInterface
$message = sprintf(" <$style>%s</>", $message); $message = sprintf(" <$style>%s</>", $message);
} }
$this->writeln(sprintf(' %s', $message), $verbosity); $this->writeln(sprintf(' %s', $message));
} }
} }
/**
* {@inheritdoc}
*/
public function success($message, bool $padding = false): void public function success($message, bool $padding = false): void
{ {
if(!$this->output->isQuiet()) { $style = $padding ? 'success-bg' : 'success';
$style = $padding ? 'success-bg' : 'success'; $this->block($message, 'OK', $style, ' ', $padding);
$this->block($message, 'OK', $style, ' ', $padding);
}
} }
/**
* {@inheritdoc}
*/
public function error($message, bool $padding = false): void public function error($message, bool $padding = false): void
{ {
if(!$this->output->isQuiet()) { $style = $padding ? 'danger-bg' : 'danger';
$style = $padding ? 'danger-bg' : 'danger'; $this->block($message, 'ERROR', $style, ' ', $padding);
$this->block($message, 'ERROR', $style, ' ', $padding);
}
} }
/**
* {@inheritdoc}
*/
public function warning($message, bool $padding = false): void public function warning($message, bool $padding = false): void
{ {
if(!$this->output->isQuiet()) { $style = $padding ? 'warning-bg' : 'warning';
$style = $padding ? 'warning-bg' : 'warning'; $this->block($message, 'WARN', $style, ' ', $padding);
$this->block($message, 'WARN', $style, ' ', $padding);
}
} }
/**
* {@inheritdoc}
*/
public function comment($message, bool $padding = false): void public function comment($message, bool $padding = false): void
{ {
if($this->output->isVeryVerbose()) { $style = $padding ? 'comment-bg' : 'comment';
$style = $padding ? 'comment-bg' : 'comment'; $this->block($message, null, $style, " // ", $padding, false);
$this->block($message, null, $style, " // ", $padding, false);
}
} }
/**
* {@inheritdoc}
*/
public function info($message, bool $padding = false): void public function info($message, bool $padding = false): void
{ {
if($this->output->isVeryVerbose()) { $style = $padding ? 'info-bg' : 'info';
$style = $padding ? 'info-bg' : 'info'; $this->block($message, 'INFO', $style, ' ', $padding);
$this->block($message, 'INFO', $style, ' ', $padding);
}
}
public function debug($message, bool $padding = false): void
{
if($this->output->isDebug()) {
$style = $padding ? 'debug-bg' : 'debug';
$this->block($message, 'DEBUG', $style, ' ', $padding);
}
} }
/**
* {@inheritdoc}
*/
public function exception(\Throwable $throwable, string $message = null): void public function exception(\Throwable $throwable, string $message = null): void
{ {
$this->error([ $this->error([
$message ?? 'An exception has occurred!', $message ?? 'An exception has occurred!',
'',
sprintf('In %s on line %s:', $throwable->getFile(), $throwable->getLine()), sprintf('In %s on line %s:', $throwable->getFile(), $throwable->getLine()),
$throwable->getMessage() $throwable->getMessage()
], true); ], true);
} }
/**
* {@inheritdoc}
*/
public function ask(string $question, $default = null, $validator = null) public function ask(string $question, $default = null, $validator = null)
{ {
$question = new Question($question, $default); $question = new BaseQuestion($question, $default);
$question->setValidator($validator); $question->setValidator($validator);
return $this->askQuestion($question); return $this->askQuestion($question);
} }
/**
* {@inheritdoc}
*/
public function password(string $question, $validator = null) public function password(string $question, $validator = null)
{ {
$question = new Question($question); $question = new BaseQuestion($question);
$question->setHidden(true); $question->setHidden(true);
$question->setValidator($validator); $question->setValidator($validator);
@ -282,27 +304,42 @@ class DefaultOutputWriter implements OutputWriterInterface
return $this->askQuestion($question); return $this->askQuestion($question);
} }
/**
* {@inheritdoc}
*/
public function confirm(string $question, $default = true): bool public function confirm(string $question, $default = true): bool
{ {
return $this->askQuestion(new ConfirmationQuestion($question, $default)); return $this->askQuestion(new BaseConfirmationQuestion($question, $default));
} }
/**
* {@inheritdoc}
*/
public function choice(string $question, array $choices, $default = null) public function choice(string $question, array $choices, $default = null)
{ {
return $this->askQuestion(new ChoiceQuestion($question, $choices, $default)); return $this->askQuestion(new BaseChoiceQuestion($question, $choices, $default));
} }
/**
* {@inheritdoc}
*/
public function startProgress(int $max = 0): void public function startProgress(int $max = 0): void
{ {
$this->progressBar = $this->createProgress($max); $this->progressBar = $this->createProgress($max);
$this->progressBar->start(); $this->progressBar->start();
} }
/**
* {@inheritdoc}
*/
public function advanceProgress(int $step = 1): void public function advanceProgress(int $step = 1): void
{ {
$this->getProgressBar()->advance($step); $this->getProgressBar()->advance($step);
} }
/**
* {@inheritdoc}
*/
public function finishProgress(): void public function finishProgress(): void
{ {
$this->getProgressBar()->finish(); $this->getProgressBar()->finish();
@ -310,21 +347,25 @@ class DefaultOutputWriter implements OutputWriterInterface
$this->progressBar = null; $this->progressBar = null;
} }
/**
* {@inheritdoc}
*/
public function createProgress(int $max = 0): ProgressBar public function createProgress(int $max = 0): ProgressBar
{ {
$progressBar = new ProgressBar($this->output, $max); $progressBar = new ProgressBar($this->output, $max);
$progressBar->setBarCharacter('<success>=</>'); if ('\\' !== \DIRECTORY_SEPARATOR || 'Hyper' === getenv('TERM_PROGRAM')) {
$progressBar->setEmptyBarCharacter('<danger> </>'); $progressBar->setEmptyBarCharacter('░'); // light shade character \u2591
$progressBar->setProgressCharacter('<warning>></>'); $progressBar->setProgressCharacter('');
$progressBar->setBarWidth(60); $progressBar->setBarCharacter('▓'); // dark shade character \u2593
$progressBar->setFormat( }
" %status%\n %current%/%max% [%bar%] %percent:3s%%\n 🏁 %estimated:-50s% %memory:20s%"
);
return $progressBar; return $progressBar;
} }
/**
* {@inheritdoc}
*/
public function newLine($count = 1): void public function newLine($count = 1): void
{ {
$this->output->write(str_repeat(PHP_EOL, $count)); $this->output->write(str_repeat(PHP_EOL, $count));
@ -365,11 +406,10 @@ class DefaultOutputWriter implements OutputWriterInterface
} }
/** /**
* @param SymfonyQuestion $question * @param Question $question
* @return mixed * @return mixed
* @throws \Exception
*/ */
protected function askQuestion(SymfonyQuestion $question) protected function askQuestion(Question $question)
{ {
if ($this->input->isInteractive()) { if ($this->input->isInteractive()) {
$this->autoPrependBlock(); $this->autoPrependBlock();
@ -381,6 +421,9 @@ class DefaultOutputWriter implements OutputWriterInterface
$answer = $this->questionHelper->ask($this->input, $this->output, $question); $answer = $this->questionHelper->ask($this->input, $this->output, $question);
if ($this->input->isInteractive()) { if ($this->input->isInteractive()) {
$this->newLine(); $this->newLine();
$this->bufferedOutput->write("\n"); $this->bufferedOutput->write("\n");
@ -437,14 +480,13 @@ class DefaultOutputWriter implements OutputWriterInterface
* Formats a message as a block of text. * Formats a message as a block of text.
* *
* @param string|array $messages The message to write in the block * @param string|array $messages The message to write in the block
* @param string|null $type The block type (added in [] on first line) * @param string|null $type The block type (added in [] on first line)
* @param string|null $style The style to apply to the whole block * @param string|null $style The style to apply to the whole block
* @param string $prefix The prefix for the block * @param string $prefix The prefix for the block
* @param bool $padding Whether to add vertical padding * @param bool $padding Whether to add vertical padding
* @param bool $escape Whether to escape the message * @param bool $escape Whether to escape the message
* @param int $verbosity
*/ */
protected function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = true, $verbosity = OutputInterface::OUTPUT_NORMAL) protected function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = true)
{ {
$messages = \is_array($messages) ? array_values($messages) : [$messages]; $messages = \is_array($messages) ? array_values($messages) : [$messages];
@ -454,7 +496,7 @@ class DefaultOutputWriter implements OutputWriterInterface
$this->autoPrependText(); $this->autoPrependText();
} }
$this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, $escape), $verbosity); $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, $escape));
if($padding) { if($padding) {
$this->newLine(); $this->newLine();

View file

@ -6,11 +6,11 @@
* *
* PHP version 7.2 * PHP version 7.2
* *
* @package Danmaku\Console\Writer * @package Arc\Base\Console\Output
* @author Marvin Schreurs <fristi@danmaku.moe> * @author Marvin Schreurs <m.schreurs@archimedetrading.eu>
*/ */
namespace Danmaku\Console\Writer; namespace Arc\Base\Console\Output;
use Symfony\Component\Console\Helper\ProgressBar; use Symfony\Component\Console\Helper\ProgressBar;
@ -19,8 +19,8 @@ use Symfony\Component\Console\Output\OutputInterface;
/** /**
* Interface OutputWriterInterface * Interface OutputWriterInterface
* *
* @package Danmaku\Console\Writer * @package Arc\Base\Console\Output
* @author Marvin Schreurs <fristi@danmaku.moe> * @author Marvin Schreurs <m.schreurs@archimedetrading.eu>
*/ */
interface OutputWriterInterface interface OutputWriterInterface
{ {
@ -62,11 +62,10 @@ interface OutputWriterInterface
* Writes an unformatted line of text. * Writes an unformatted line of text.
* *
* @param string|array $message Message to display. * @param string|array $message Message to display.
* @param string|null $style Style to apply to the message. * @param string|null $style Style to apply to the message.
* @param int $verbosity Verbosity level at which this message should be printed.
* @return void * @return void
*/ */
public function text($message, string $style = null, $verbosity = OutputInterface::VERBOSITY_NORMAL): void; public function text($message, string $style = null): void;
/** /**
* Formats a success message. * Formats a success message.
@ -113,15 +112,6 @@ interface OutputWriterInterface
*/ */
public function info($message, bool $padding = false): void; public function info($message, bool $padding = false): void;
/**
* Formats a debug message.
*
* @param string|array $message Message to display.
* @param bool $padding Render the message in a padded box.
* @return void
*/
public function debug($message, bool $padding = false): void;
/** /**
* Formats an exception. * Formats an exception.
* *

View file

@ -0,0 +1,31 @@
<?php
/**
* BaseChoiceQuestion class source file.
*
* Contains the source code of the BaseChoiceQuestion class.
*
* PHP version 7.2
*
* @package Arc\Base\Console\Question
* @author Marvin Schreurs <m.schreurs@archimedetrading.eu>
*/
namespace Arc\Base\Console\Question;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Question\ChoiceQuestion;
/**
* Class BaseChoiceQuestion
*
* @package Arc\Base\Console\Question
* @author Marvin Schreurs <m.schreurs@archimedetrading.eu>
*/
class BaseChoiceQuestion extends ChoiceQuestion
{
protected function isAssoc($array)
{
return true;
}
}

View file

@ -0,0 +1,30 @@
<?php
/**
* BaseConfirmationQuestion class source file.
*
* Contains the source code of the BaseConfirmationQuestion class.
*
* PHP version 7.2
*
* @package Arc\Base\Console\Question
* @author Marvin Schreurs <m.schreurs@archimedetrading.eu>
*/
namespace Arc\Base\Console\Question;
use Symfony\Component\Console\Question\ConfirmationQuestion;
/**
* Class BaseConfirmationQuestion
*
* @package Arc\Base\Console\Question
* @author Marvin Schreurs <m.schreurs@archimedetrading.eu>
*/
class BaseConfirmationQuestion extends ConfirmationQuestion
{
protected function isAssoc($array)
{
return true;
}
}

View file

@ -0,0 +1,30 @@
<?php
/**
* BaseQuestion class source file.
*
* Contains the source code of the BaseQuestion class.
*
* PHP version 7.2
*
* @package Arc\Base\Console\Question
* @author Marvin Schreurs <m.schreurs@archimedetrading.eu>
*/
namespace Arc\Base\Console\Question;
use Symfony\Component\Console\Question\Question;
/**
* Class BaseQuestion
*
* @package Arc\Base\Console\Question
* @author Marvin Schreurs <m.schreurs@archimedetrading.eu>
*/
class BaseQuestion extends Question
{
protected function isAssoc($array)
{
return true;
}
}

View file

@ -1,31 +0,0 @@
<?php
/**
* ChoiceQuestion class source file.
*
* Contains the source code of the ChoiceQuestion class.
*
* PHP version 7.2
*
* @package Danmaku\Console\Question
* @author Marvin Schreurs <fristi@danmaku.moe>
*/
namespace Danmaku\Console\Question;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Question\ChoiceQuestion as SymfonyChoiceQuestion;
/**
* Class ChoiceQuestion
*
* @package Danmaku\Console\Question
* @author Marvin Schreurs <fristi@danmaku.moe>
*/
class ChoiceQuestion extends SymfonyChoiceQuestion
{
protected function isAssoc($array)
{
return true;
}
}

View file

@ -1,30 +0,0 @@
<?php
/**
* ConfirmationQuestion class source file.
*
* Contains the source code of the ConfirmationQuestion class.
*
* PHP version 7.2
*
* @package Danmaku\Console\Question
* @author Marvin Schreurs <fristi@danmaku.moe>
*/
namespace Danmaku\Console\Question;
use Symfony\Component\Console\Question\ConfirmationQuestion as SymfonyConfirmationQuestion;
/**
* Class ConfirmationQuestion
*
* @package Danmaku\Console\Question
* @author Marvin Schreurs <fristi@danmaku.moe>
*/
class ConfirmationQuestion extends SymfonyConfirmationQuestion
{
protected function isAssoc($array)
{
return true;
}
}

View file

@ -1,30 +0,0 @@
<?php
/**
* Question class source file.
*
* Contains the source code of the Question class.
*
* PHP version 7.2
*
* @package Danmaku\Console\Question
* @author Marvin Schreurs <fristi@danmaku.moe>
*/
namespace Danmaku\Console\Question;
use Symfony\Component\Console\Question\Question as SymfonyQuestion;
/**
* Class Question
*
* @package Danmaku\Console\Question
* @author Marvin Schreurs <fristi@danmaku.moe>
*/
class Question extends SymfonyQuestion
{
protected function isAssoc($array)
{
return true;
}
}