| Total Complexity | 10 |
| Total Lines | 62 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 9 | class ModelsFinder |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * Find the models in the given directory. |
||
| 13 | * |
||
| 14 | * @param string $directory |
||
| 15 | * |
||
| 16 | * @return array|string[] |
||
| 17 | * @throws \ReflectionException |
||
| 18 | */ |
||
| 19 | public function findInDirectory(string $directory): array |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Retrieve the fully-qualified class name of the given file. |
||
| 36 | * |
||
| 37 | * @param SplFileInfo $file |
||
| 38 | * |
||
| 39 | * @return string|null |
||
| 40 | */ |
||
| 41 | protected function determineClassFromFile(SplFileInfo $file) |
||
| 42 | { |
||
| 43 | if (!preg_match('/namespace (.*);/', $file->getContents(), $matches)) { |
||
| 44 | return null; |
||
| 45 | } |
||
| 46 | |||
| 47 | return $matches[1] . '\\' . rtrim($file->getFilename(), '.php'); |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Determine if the given class is an eloquent model. |
||
| 52 | * |
||
| 53 | * @param string $class |
||
| 54 | * |
||
| 55 | * @return bool |
||
| 56 | * @throws \ReflectionException |
||
| 57 | */ |
||
| 58 | protected function isModelClass(string $class): bool |
||
| 71 | } |
||
| 72 | } |
||
| 73 |