@@ -93,6 +93,10 @@ class Autoloader
9393 */
9494 protected $ helpers = ['url ' ];
9595
96+ public function __construct (private readonly string $ composerPath = COMPOSER_PATH )
97+ {
98+ }
99+
96100 /**
97101 * Reads in the configuration array (described above) and stores
98102 * the valid parts that we'll need.
@@ -127,7 +131,7 @@ public function initialize(Autoload $config, Modules $modules)
127131 $ this ->helpers = [...$ this ->helpers , ...$ config ->helpers ];
128132 }
129133
130- if (is_file (COMPOSER_PATH )) {
134+ if (is_file ($ this -> composerPath )) {
131135 $ this ->loadComposerAutoloader ($ modules );
132136 }
133137
@@ -139,11 +143,11 @@ private function loadComposerAutoloader(Modules $modules): void
139143 // The path to the vendor directory.
140144 // We do not want to enforce this, so set the constant if Composer was used.
141145 if (! defined ('VENDORPATH ' )) {
142- define ('VENDORPATH ' , dirname (COMPOSER_PATH ) . DIRECTORY_SEPARATOR );
146+ define ('VENDORPATH ' , dirname ($ this -> composerPath ) . DIRECTORY_SEPARATOR );
143147 }
144148
145149 /** @var ClassLoader $composer */
146- $ composer = include COMPOSER_PATH ;
150+ $ composer = include $ this -> composerPath ;
147151
148152 // Should we load through Composer's namespaces, also?
149153 if ($ modules ->discoverInComposer ) {
0 commit comments