class AutoloadGenerator (View source)

Methods

__construct(EventDispatcher $eventDispatcher, IOInterface $io = null)

No description

setDevMode($devMode = true)

No description

setClassMapAuthoritative(bool $classMapAuthoritative)

Whether or not generated autoloader considers the class map authoritative.

setApcu(bool $apcu)

Whether or not generated autoloader considers APCu caching.

setRunScripts(bool $runScripts = true)

Set whether to run scripts or not

dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '')

No description

buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages)

No description

validatePackage(PackageInterface $package)

No description

array
parseAutoloads(array $packageMap, PackageInterface $mainPackage)

Compiles an ordered list of namespace => path mappings

createLoader(array $autoloads)

Registers an autoloader based on an autoload map returned by parseAutoloads

getIncludePathsFile(array $packageMap, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)

No description

getIncludeFilesFile(array $files, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)

No description

getPathCode(Filesystem $filesystem, $basePath, $vendorPath, $path)

No description

getAutoloadFile($vendorPathToTargetDirCode, $suffix)

No description

getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $useIncludeFiles, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion = 70000)

No description

getStaticFile($suffix, $targetDir, $vendorPath, $basePath, $staticPhpVersion)

No description

parseAutoloadsType(array $packageMap, $type, PackageInterface $mainPackage)

No description

getFileIdentifier(PackageInterface $package, $path)

No description

array
filterPackageMap(array $packageMap, PackageInterface $mainPackage)

Filters out dev-dependencies when not in dev-mode

array
sortPackageMap(array $packageMap)

Sorts packages by dependency weight

safeCopy(string $source, string $target)

Copy file using stream_copy_to_stream to work around https://bugs.php.net/bug.php?id=6463

Details

__construct(EventDispatcher $eventDispatcher, IOInterface $io = null)

Parameters

EventDispatcher $eventDispatcher
IOInterface $io

setDevMode($devMode = true)

Parameters

$devMode

setClassMapAuthoritative(bool $classMapAuthoritative)

Whether or not generated autoloader considers the class map authoritative.

Parameters

bool $classMapAuthoritative

setApcu(bool $apcu)

Whether or not generated autoloader considers APCu caching.

Parameters

bool $apcu

setRunScripts(bool $runScripts = true)

Set whether to run scripts or not

Parameters

bool $runScripts

dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '')

Parameters

Config $config
InstalledRepositoryInterface $localRepo
PackageInterface $mainPackage
InstallationManager $installationManager
$targetDir
$scanPsr0Packages
$suffix

buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages)

Parameters

InstallationManager $installationManager
PackageInterface $mainPackage
array $packages

protected validatePackage(PackageInterface $package)

Parameters

PackageInterface $package

Exceptions

InvalidArgumentException Throws an exception, if the package has illegal settings.

array parseAutoloads(array $packageMap, PackageInterface $mainPackage)

Compiles an ordered list of namespace => path mappings

Parameters

array $packageMap array of array(package, installDir-relative-to-composer.json)
PackageInterface $mainPackage root package instance

Return Value

array array('psr-0' => array('Ns\Foo' => array('installDir')))

ClassLoader createLoader(array $autoloads)

Registers an autoloader based on an autoload map returned by parseAutoloads

Parameters

array $autoloads see parseAutoloads return value

Return Value

ClassLoader

protected getIncludePathsFile(array $packageMap, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)

Parameters

array $packageMap
Filesystem $filesystem
$basePath
$vendorPath
$vendorPathCode
$appBaseDirCode

protected getIncludeFilesFile(array $files, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)

Parameters

array $files
Filesystem $filesystem
$basePath
$vendorPath
$vendorPathCode
$appBaseDirCode

protected getPathCode(Filesystem $filesystem, $basePath, $vendorPath, $path)

Parameters

Filesystem $filesystem
$basePath
$vendorPath
$path

protected getAutoloadFile($vendorPathToTargetDirCode, $suffix)

Parameters

$vendorPathToTargetDirCode
$suffix

protected getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $useIncludeFiles, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion = 70000)

Parameters

$useClassMap
$useIncludePath
$targetDirLoader
$useIncludeFiles
$vendorPathCode
$appBaseDirCode
$suffix
$useGlobalIncludePath
$prependAutoloader
$staticPhpVersion

protected getStaticFile($suffix, $targetDir, $vendorPath, $basePath, $staticPhpVersion)

Parameters

$suffix
$targetDir
$vendorPath
$basePath
$staticPhpVersion

protected parseAutoloadsType(array $packageMap, $type, PackageInterface $mainPackage)

Parameters

array $packageMap
$type
PackageInterface $mainPackage

protected getFileIdentifier(PackageInterface $package, $path)

Parameters

PackageInterface $package
$path

protected array filterPackageMap(array $packageMap, PackageInterface $mainPackage)

Filters out dev-dependencies when not in dev-mode

Parameters

array $packageMap
PackageInterface $mainPackage

Return Value

array

protected array sortPackageMap(array $packageMap)

Sorts packages by dependency weight

Packages of equal weight retain the original order

Parameters

array $packageMap

Return Value

array

protected safeCopy(string $source, string $target)

Copy file using stream_copy_to_stream to work around https://bugs.php.net/bug.php?id=6463

Parameters

string $source
string $target