Skip to content

Commit aae39d6

Browse files
author
Jordan Hoff
committed
Parse only php files
1 parent eb984ae commit aae39d6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/ModelFinder.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
namespace BeyondCode\ErdGenerator;
44

5+
use Illuminate\Support\Str;
56
use PhpParser\NodeTraverser;
67
use PhpParser\ParserFactory;
78
use PhpParser\Node\Stmt\Class_;
8-
use PhpParser\Node\Stmt\Namespace_;
99
use Illuminate\Support\Collection;
10+
use PhpParser\Node\Stmt\Namespace_;
1011
use Illuminate\Filesystem\Filesystem;
1112
use PhpParser\NodeVisitor\NameResolver;
1213
use Illuminate\Database\Eloquent\Model as EloquentModel;
@@ -28,7 +29,9 @@ public function getModelsInDirectory(string $directory): Collection
2829
$this->filesystem->allFiles($directory) :
2930
$this->filesystem->files($directory);
3031

31-
return Collection::make($files)->map(function ($path) {
32+
return Collection::make($files)->filter(function ($path) {
33+
return Str::endsWith($path, '.php');
34+
})->map(function ($path) {
3235
return $this->getFullyQualifiedClassNameFromFile($path);
3336
})->filter(function (string $className) {
3437
return !empty($className);

0 commit comments

Comments
 (0)