Remove verbose comments

Just show when it's actually a Model, not every class (for L5
especially). See #135
This commit is contained in:
Barry vd. Heuvel
2014-11-29 12:53:37 +01:00
parent 486d9d9c4d
commit 736f2f387e
+7 -9
View File
@@ -150,8 +150,6 @@ class ModelsCommand extends Command
if (in_array($name, $ignore)) { if (in_array($name, $ignore)) {
$this->comment("Ignoring model '$name'"); $this->comment("Ignoring model '$name'");
continue; continue;
} else {
$this->comment("Loading model '$name'");
} }
$this->properties = array(); $this->properties = array();
$this->methods = array(); $this->methods = array();
@@ -159,11 +157,15 @@ class ModelsCommand extends Command
try { try {
// handle abstract classes, interfaces, ... // handle abstract classes, interfaces, ...
$reflectionClass = new \ReflectionClass($name); $reflectionClass = new \ReflectionClass($name);
if (!$reflectionClass->isSubclassOf('Illuminate\Database\Eloquent\Model')) {
continue;
}
$this->comment("Loading model '$name'");
if (!$reflectionClass->IsInstantiable()) { if (!$reflectionClass->IsInstantiable()) {
throw new \Exception($name . ' is not instanciable.'); throw new \Exception($name . ' is not instanciable.');
} elseif (!$reflectionClass->isSubclassOf('Illuminate\Database\Eloquent\Model')) {
$this->comment("Class '$name' is not a model");
continue;
} }
$model = new $name(); $model = new $name();
@@ -175,10 +177,6 @@ class ModelsCommand extends Command
} catch (\Exception $e) { } catch (\Exception $e) {
$this->error("Exception: " . $e->getMessage() . "\nCould not analyze class $name."); $this->error("Exception: " . $e->getMessage() . "\nCould not analyze class $name.");
} }
} elseif (interface_exists($name) || (function_exists('trait_exists') && trait_exists($name))) {
$this->info("Skipping interface/trait $name");
} else {
$this->error("Class $name does not exist");
} }
} }