File tree Expand file tree Collapse file tree 1 file changed +21
-5
lines changed Expand file tree Collapse file tree 1 file changed +21
-5
lines changed Original file line number Diff line number Diff line change 1
1
<?php namespace Tatter \Schemas \Drafter \Handlers ;
2
2
3
3
use CodeIgniter \Config \BaseConfig ;
4
+ use CodeIgniter \Model ;
4
5
use Config \Services ;
5
6
use Tatter \Schemas \Drafter \BaseDrafter ;
6
7
use Tatter \Schemas \Drafter \DrafterInterface ;
@@ -162,12 +163,27 @@ protected function getModels(): array
162
163
// Try to load each class
163
164
foreach ($ classes as $ class )
164
165
{
165
- // Try to instantiate
166
- try { $ instance = new $ class (); }
167
- catch (\Exception $ e ) { continue ; }
168
-
166
+ // Check for ignored namespaces
167
+ foreach ($ this ->config ->ignoredNamespaces as $ namespace )
168
+ {
169
+ if (strpos ($ class , $ namespace ) === 0 )
170
+ {
171
+ continue 2 ;
172
+ }
173
+ }
174
+
169
175
// Make sure it's really a model
170
- if (! ($ instance instanceof \CodeIgniter \Model))
176
+ if (! is_a ($ class , Model::class, true ))
177
+ {
178
+ continue ;
179
+ }
180
+
181
+ // Try to instantiate
182
+ try
183
+ {
184
+ $ instance = new $ class ();
185
+ }
186
+ catch (\Exception $ e )
171
187
{
172
188
continue ;
173
189
}
You can’t perform that action at this time.
0 commit comments