From 8515b7ac0b4592f048ea95f7c80ac115e4a1d8b3 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Thu, 18 Jun 2015 09:11:05 +0200 Subject: [PATCH] Use verbosity to hide some errors --- src/Console/MetaCommand.php | 5 ++++- src/Console/ModelsCommand.php | 9 +++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Console/MetaCommand.php b/src/Console/MetaCommand.php index f7a9e65..94abd6b 100644 --- a/src/Console/MetaCommand.php +++ b/src/Console/MetaCommand.php @@ -12,6 +12,7 @@ namespace Barryvdh\LaravelIdeHelper\Console; use Illuminate\Console\Command; use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; /** * A command to generate phpstorm meta data @@ -78,7 +79,9 @@ class MetaCommand extends Command { $bindings[$abstract] = get_class($concrete); } }catch (\Exception $e) { - $this->comment("Cannot make '$abstract': ".$e->getMessage()); + if ($this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { + $this->comment("Cannot make '$abstract': ".$e->getMessage()); + } } } diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index f995a21..019f0af 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -14,6 +14,7 @@ use Illuminate\Console\Command; use Illuminate\Support\Str; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\ClassLoader\ClassMapGenerator; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\DocBlock\Context; @@ -148,7 +149,9 @@ class ModelsCommand extends Command foreach ($models as $name) { if (in_array($name, $ignore)) { - $this->comment("Ignoring model '$name'"); + if ($this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { + $this->comment("Ignoring model '$name'"); + } continue; } $this->properties = array(); @@ -162,7 +165,9 @@ class ModelsCommand extends Command continue; } - $this->comment("Loading model '$name'"); + if ($this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { + $this->comment("Loading model '$name'"); + } if (!$reflectionClass->IsInstantiable()) { throw new \Exception($name . ' is not instantiable.');