Resolve a single path entry from `autoload_psr4.php`. Handles `$vendorDir . '/path'` and `$baseDir . '/path'`.
(entry: &str, vendor_dir: &str)
| 248 | /// |
| 249 | /// Handles `$vendorDir . '/path'` and `$baseDir . '/path'`. |
| 250 | fn resolve_autoload_path_entry(entry: &str, vendor_dir: &str) -> Option<String> { |
| 251 | let entry = entry.trim(); |
| 252 | |
| 253 | if let Some(rest) = entry.strip_prefix("$vendorDir . '") { |
| 254 | // $vendorDir . '/org/pkg/src' |
| 255 | let path = rest.strip_suffix('\'')?; |
| 256 | let path = path.strip_prefix('/').unwrap_or(path); |
| 257 | Some(format!("{}/{}", vendor_dir, path)) |
| 258 | } else if let Some(rest) = entry.strip_prefix("$baseDir . '") { |
| 259 | // $baseDir . '/lib' |
| 260 | let path = rest.strip_suffix('\'')?; |
| 261 | let path = path.strip_prefix('/').unwrap_or(path); |
| 262 | Some(path.to_string()) |
| 263 | } else { |
| 264 | None |
| 265 | } |
| 266 | } |
| 267 | |
| 268 | /// Parse `<vendor>/composer/autoload_files.php` and return the resolved |
| 269 | /// file paths. |
no outgoing calls
no test coverage detected