Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: delete duplicate code for Composer loading #8004

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions system/Autoloader/Autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,21 @@ public function initialize(Autoload $config, Modules $modules)
}

if (is_file(COMPOSER_PATH)) {
$this->loadComposerInfo($modules);
$this->loadComposerAutoloader($modules);
}

return $this;
}

private function loadComposerInfo(Modules $modules): void
private function loadComposerAutoloader(Modules $modules): void
{
/**
* @var ClassLoader $composer
*/
// The path to the vendor directory.
// We do not want to enforce this, so set the constant if Composer was used.
if (! defined('VENDORPATH')) {
define('VENDORPATH', dirname(COMPOSER_PATH) . DIRECTORY_SEPARATOR);
}

/** @var ClassLoader $composer */
$composer = include COMPOSER_PATH;

$this->loadComposerClassmap($composer);
Expand Down
14 changes: 0 additions & 14 deletions system/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,3 @@
// Initialize and register the loader with the SPL autoloader stack.
Services::autoloader()->initialize(new Autoload(), new Modules())->register();
Services::autoloader()->loadHelpers();

// Now load Composer's if it's available
if (is_file(COMPOSER_PATH)) {
/*
* The path to the vendor directory.
*
* We do not want to enforce this, so set the constant if Composer was used.
*/
if (! defined('VENDORPATH')) {
define('VENDORPATH', dirname(COMPOSER_PATH) . DIRECTORY_SEPARATOR);
}

require_once COMPOSER_PATH;
}
Loading