1 | <?php |
||
18 | final class AutoloaderLocator |
||
19 | { |
||
20 | /** |
||
21 | * @codeCoverageIgnore cannot test without side-effects |
||
22 | */ |
||
23 | public static function autoload() |
||
27 | |||
28 | /** |
||
29 | * Attempts to find the location of the vendor folder. |
||
30 | * |
||
31 | * This method tries to check for a composer.json in a directory 5 levels below the folder of this Bootstrap file. |
||
32 | * This is the expected location if phpDocumentor is installed using composer because the current directory for |
||
33 | * this file is expected to be 'vendor/phpdocumentor/phpdocumentor/src/phpDocumentor'. |
||
34 | * |
||
35 | * If a composer.json is found we will try to extract the vendor folder name using the 'vendor-dir' configuration |
||
36 | * option of composer or assume it is vendor if that option is not set. |
||
37 | * |
||
38 | * |
||
39 | * If no custom composer.json can be found, then we assume that the vendor folder is that of phpDocumentor itself, |
||
40 | * which is `../../vendor` starting from this folder. |
||
41 | * |
||
42 | * If neither locations exist, then this method returns null because no vendor path could be found. |
||
43 | * |
||
44 | * @param string $baseDir parameter for test purposes only. |
||
45 | * @return string |
||
46 | */ |
||
47 | 3 | public static function findVendorPath($baseDir = __DIR__): string |
|
60 | /** |
||
61 | * Retrieves the custom vendor-dir from the given composer.json or returns 'vendor'. |
||
62 | * |
||
63 | * @param string $composerConfigurationPath the path pointing to the composer.json |
||
64 | * |
||
65 | * @return string |
||
66 | */ |
||
67 | 2 | private static function getCustomVendorPathFromComposer($composerConfigurationPath): string |
|
73 | } |
||
74 |