Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. AutoloadGenerator.php

function AutoloadGenerator::getAutoloadFile

Return value

string

1 call to AutoloadGenerator::getAutoloadFile()
AutoloadGenerator::dump in vendor/composer/composer/src/Composer/Autoload/AutoloadGenerator.php

File

vendor/composer/composer/src/Composer/Autoload/AutoloadGenerator.php, line 947

Class

AutoloadGenerator
@author Igor Wiedler <igor@wiedler.ch> @author Jordi Boggiano <j.boggiano@seld.be>

Namespace

Composer\Autoload

Code

protected function getAutoloadFile(string $vendorPathToTargetDirCode, string $suffix) {
    $lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode) - 1];
    if ("'" === $lastChar || '"' === $lastChar) {
        $vendorPathToTargetDirCode = substr($vendorPathToTargetDirCode, 0, -1) . '/autoload_real.php' . $lastChar;
    }
    else {
        $vendorPathToTargetDirCode .= " . '/autoload_real.php'";
    }
    return <<<AUTOLOAD
<?php

// autoload.php @generated by Composer

if (PHP_VERSION_ID < 50600) {
    if (!headers_sent()) {
        header('HTTP/1.1 500 Internal Server Error');
    }
    \$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
    if (!ini_get('display_errors')) {
        if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
            fwrite(STDERR, \$err);
        } elseif (!headers_sent()) {
            echo \$err;
        }
    }
    trigger_error(
        \$err,
        E_USER_ERROR
    );
}

require_once {<span class="php-variable">$vendorPathToTargetDirCode</span>};

return ComposerAutoloaderInit{<span class="php-variable">$suffix</span>}::getLoader();

AUTOLOAD;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal