Recursively scan a directory for PHP files and extract class names using the lightweight byte-level scanner.
(dir: &Path, classmap: &mut HashMap<String, PathBuf>)
| 579 | /// Recursively scan a directory for PHP files and extract class names |
| 580 | /// using the lightweight byte-level scanner. |
| 581 | fn scan_directory_for_classes(dir: &Path, classmap: &mut HashMap<String, PathBuf>) { |
| 582 | let entries = match fs::read_dir(dir) { |
| 583 | Ok(e) => e, |
| 584 | Err(_) => return, |
| 585 | }; |
| 586 | |
| 587 | for entry in entries.flatten() { |
| 588 | let path = entry.path(); |
| 589 | if path.is_dir() { |
| 590 | scan_directory_for_classes(&path, classmap); |
| 591 | } else if path.extension().is_some_and(|ext| ext == "php") |
| 592 | && let Ok(content) = fs::read(&path) |
| 593 | { |
| 594 | let classes = crate::classmap_scanner::find_classes(&content); |
| 595 | for fqn in classes { |
| 596 | classmap.entry(fqn).or_insert_with(|| path.clone()); |
| 597 | } |
| 598 | } |
| 599 | } |
| 600 | } |
| 601 | |
| 602 | /// Detect `.phar` archive references in a PHP bootstrap file. |
| 603 | /// |
no test coverage detected