function GenerateAutoloadReferenceFile::autoLoadContents

Same name in other branches
  1. 9 composer/Plugin/Scaffold/GenerateAutoloadReferenceFile.php \Drupal\Composer\Plugin\Scaffold\GenerateAutoloadReferenceFile::autoLoadContents()
  2. 8.9.x composer/Plugin/Scaffold/GenerateAutoloadReferenceFile.php \Drupal\Composer\Plugin\Scaffold\GenerateAutoloadReferenceFile::autoLoadContents()
  3. 10 composer/Plugin/Scaffold/GenerateAutoloadReferenceFile.php \Drupal\Composer\Plugin\Scaffold\GenerateAutoloadReferenceFile::autoLoadContents()

Builds the contents of the autoload file.

Parameters

string $relative_autoload_path: The relative path to the autoloader in vendor.

Return value

string Return the contents for the autoload.php.

1 call to GenerateAutoloadReferenceFile::autoLoadContents()
GenerateAutoloadReferenceFile::generateAutoload in composer/Plugin/Scaffold/GenerateAutoloadReferenceFile.php
Generates the autoload file at the specified location.

File

composer/Plugin/Scaffold/GenerateAutoloadReferenceFile.php, line 101

Class

GenerateAutoloadReferenceFile
Generates an 'autoload.php' that includes the autoloader created by Composer.

Namespace

Drupal\Composer\Plugin\Scaffold

Code

protected static function autoLoadContents($relative_autoload_path) {
    $relative_autoload_path = preg_replace('#^\\./#', '', $relative_autoload_path);
    return <<<EOF
<?php

/**
 * @file
 * Includes the autoloader created by Composer.
 *
 * This file was generated by drupal-scaffold.
 *
 * @see composer.json
 * @see index.php
 * @see core/install.php
 * @see core/rebuild.php
 */

return require __DIR__ . '/{<span class="php-variable">$relative_autoload_path</span>}';

EOF;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.