From c4297286ab677845d386bd4c0d9e4e146397c62d Mon Sep 17 00:00:00 2001 From: MGatner Date: Wed, 11 Nov 2020 21:08:50 +0000 Subject: [PATCH] Improve ignoring and class filtering --- src/Drafter/Handlers/ModelHandler.php | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/Drafter/Handlers/ModelHandler.php b/src/Drafter/Handlers/ModelHandler.php index 371381f..78014bf 100644 --- a/src/Drafter/Handlers/ModelHandler.php +++ b/src/Drafter/Handlers/ModelHandler.php @@ -1,6 +1,7 @@ config->ignoredNamespaces as $namespace) + { + if (strpos($class, $namespace) === 0) + { + continue 2; + } + } + // Make sure it's really a model - if (! ($instance instanceof \CodeIgniter\Model)) + if (! is_a($class, Model::class, true)) + { + continue; + } + + // Try to instantiate + try + { + $instance = new $class(); + } + catch (\Exception $e) { continue; }