You are here

protected static function GenerateAutoloadReferenceFile::autoLoadContents in Drupal 9

Same name and namespace in other branches
  1. 8 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
 * @see core/modules/statistics/statistics.php
 */

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

EOF;
}