From ba09c21c05718d39e2878ae9ca4dad0d66d220a1 Mon Sep 17 00:00:00 2001 From: yunwuxin <448901948@qq.com> Date: Wed, 23 Mar 2016 18:08:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3console?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Console.php | 2 +- library/think/console/output/Null.php | 109 ++++++++++++++++++++++++++ 2 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 library/think/console/output/Null.php diff --git a/library/think/Console.php b/library/think/Console.php index 5035958a..24b85134 100644 --- a/library/think/Console.php +++ b/library/think/Console.php @@ -740,7 +740,7 @@ class Console public static function addDefaultCommands(array $classnames) { - self::$defaultCommands[] = array_merge(self::$defaultCommands, $classnames); + self::$defaultCommands = array_merge(self::$defaultCommands, $classnames); } /** diff --git a/library/think/console/output/Null.php b/library/think/console/output/Null.php new file mode 100644 index 00000000..4e8f355c --- /dev/null +++ b/library/think/console/output/Null.php @@ -0,0 +1,109 @@ + +// +---------------------------------------------------------------------- + +namespace think\console\output; + + +use think\console\Output; + +class Null extends Output +{ + /** @noinspection PhpMissingParentConstructorInspection */ + public function __construct() + { + + } + + /** + * {@inheritdoc} + */ + public function setFormatter(Formatter $formatter) + { + // do nothing + } + + /** + * {@inheritdoc} + */ + public function getFormatter() + { + // to comply with the interface we must return a OutputFormatterInterface + return new Formatter(); + } + + /** + * {@inheritdoc} + */ + public function setDecorated($decorated) + { + // do nothing + } + + /** + * {@inheritdoc} + */ + public function isDecorated() + { + return false; + } + + /** + * {@inheritdoc} + */ + public function setVerbosity($level) + { + // do nothing + } + + /** + * {@inheritdoc} + */ + public function getVerbosity() + { + return self::VERBOSITY_QUIET; + } + + public function isQuiet() + { + return true; + } + + public function isVerbose() + { + return false; + } + + public function isVeryVerbose() + { + return false; + } + + public function isDebug() + { + return false; + } + + /** + * {@inheritdoc} + */ + public function writeln($messages, $options = self::OUTPUT_NORMAL) + { + // do nothing + } + + /** + * {@inheritdoc} + */ + public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL) + { + // do nothing + } +} \ No newline at end of file