inti project
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Support\Architecture;
|
||||
|
||||
use RecursiveDirectoryIterator;
|
||||
use RecursiveIteratorIterator;
|
||||
|
||||
final class ArchitectureFileFinder
|
||||
{
|
||||
/** @return string[] */
|
||||
public function phpFiles(array $paths): array
|
||||
{
|
||||
$files = [];
|
||||
foreach ($paths as $path) {
|
||||
$absolute = base_path($path);
|
||||
if (is_file($absolute) && str_ends_with($absolute, '.php')) {
|
||||
$files[] = $absolute;
|
||||
continue;
|
||||
}
|
||||
if (! is_dir($absolute)) {
|
||||
continue;
|
||||
}
|
||||
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($absolute)) as $file) {
|
||||
if ($file->isFile() && $file->getExtension() === 'php') {
|
||||
$files[] = $file->getPathname();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sort($files);
|
||||
return array_values(array_unique($files));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user