Contents

October\Rain\Composer\ClassLoader

Overview

ClassLoader is a custom autoloader used by October CMS, it uses folder names to be lower case and the file name to be capitalized as per the class name.


Public Properties

public string $basePath

public string|null $manifestPath

public array $manifest

manifest of loaded items

Protected Properties

protected array $unknownClasses

unknownClasses cache

protected bool $manifestDirty

manifestDirty if manifest needs to be written

protected array $namespaces

namespaces registered

protected array $directories

directories registered

protected bool $registered

registered indicates if this class is registered


Public Methods

public __construct()

public __construct($basePath): void

__construct creates a new package manifest instance

public build()

public build(): void

build the manifest and write it to disk

public static configure()

public static configure($basePath): void

configure the loader

public getDirectories()

public getDirectories(): array 

getDirectories registered with the loader

public initManifest()

public initManifest($manifestPath): void

initManifest starts the manifest cache file after registration.

public static instance()

public static instance(): static|null 

instance returns the class loader instance

public load()

public load(string $class): bool 

load the given class file

public register()

public register(): void

register the given class loader on the auto-loader stack

public removeDirectories()

public removeDirectories(string|array $directories = null): void

removeDirectories from the class loader

public withDirectories()

public withDirectories(string|array $directories): static 

withDirectories to the class loader

public withNamespace()

public withNamespace($namespace, $directory): static 

Protected Methods

protected ensureManifestIsLoaded()

protected ensureManifestIsLoaded(): void

ensureManifestIsLoaded has been loaded into memory

protected includeClass()

protected includeClass($class, $path): void

includeClass and add to the manifest

protected isRealFilePath()

protected isRealFilePath($path): bool 

isRealFilePath determines if a relative path to a file exists and is real

protected loadUpperOrLower()

protected loadUpperOrLower($class, $directory, $upperClass, $lowerClass): bool 

loadUpperOrLower loads a class in a directory with the supplied upper and lower class path.

protected normalizeClass()

protected normalizeClass($class): array 

normalizeClass get the normal file name for a class

protected write()

protected write($manifest): void

write the given manifest array to disk