HumHub Documentation (unofficial)

StandardAutoloader
in package
implements SplAutoloader

PSR-0 compliant autoloader

Allows autoloading both namespaced and vendor-prefixed classes. Class lookups are performed on the filesystem. If a class file for the referenced class is not found, a PHP warning will be raised by include().

Table of Contents

Interfaces

SplAutoloader
Defines an interface for classes that may register with the spl_autoload registry

Constants

ACT_AS_FALLBACK  = 'fallback_autoloader'
AUTOREGISTER_LAMINAS  = 'autoregister_laminas'
AUTOREGISTER_ZF  = 'autoregister_laminas'
LOAD_NS  = 'namespaces'
LOAD_PREFIX  = 'prefixes'
NS_SEPARATOR  = '\\'
PREFIX_SEPARATOR  = '_'

Properties

$fallbackAutoloaderFlag  : bool
$namespaces  : array<string|int, mixed>
$prefixes  : array<string|int, mixed>

Methods

__construct()  : mixed
Constructor
autoload()  : false|string
Defined by Autoloadable; autoload a class
isFallbackAutoloader()  : bool
Is this autoloader acting as a fallback autoloader?
register()  : void
Register the autoloader with spl_autoload
registerNamespace()  : StandardAutoloader
Register a namespace/directory pair
registerNamespaces()  : StandardAutoloader
Register many namespace/directory pairs at once
registerPrefix()  : StandardAutoloader
Register a prefix/directory pair
registerPrefixes()  : StandardAutoloader
Register many namespace/directory pairs at once
setFallbackAutoloader()  : StandardAutoloader
Set flag indicating fallback autoloader status
setOptions()  : StandardAutoloader
Configure autoloader
loadClass()  : bool|string
Load a class, based on its type (namespaced or prefixed)
normalizeDirectory()  : string
Normalize the directory to include a trailing directory separator
transformClassNameToFilename()  : string
Transform the class name to a filename

Constants

AUTOREGISTER_ZF

public mixed AUTOREGISTER_ZF = 'autoregister_laminas'
Tags
deprecated

Use AUTOREGISTER_LAMINAS instead

Properties

$fallbackAutoloaderFlag

protected bool $fallbackAutoloaderFlag = false

Whether or not the autoloader should also act as a fallback autoloader

$namespaces

protected array<string|int, mixed> $namespaces = []

Namespace/directory pairs to search; Laminas library added by default

$prefixes

protected array<string|int, mixed> $prefixes = []

Prefix/directory pairs to search

Methods

__construct()

Constructor

public __construct([null|array<string|int, mixed>|Traversable $options = null ]) : mixed
Parameters
$options : null|array<string|int, mixed>|Traversable = null

autoload()

Defined by Autoloadable; autoload a class

public autoload(string $class) : false|string
Parameters
$class : string
Return values
false|string

isFallbackAutoloader()

Is this autoloader acting as a fallback autoloader?

public isFallbackAutoloader() : bool
Return values
bool

setOptions()

Configure autoloader

public setOptions(array<string|int, mixed>|Traversable $options) : StandardAutoloader

Allows specifying both "namespace" and "prefix" pairs, using the following structure: array( 'namespaces' => array( 'Laminas' => '/path/to/Laminas/library', 'Doctrine' => '/path/to/Doctrine/library', ), 'prefixes' => array( 'Phly_' => '/path/to/Phly/library', ), 'fallback_autoloader' => true, )

Parameters
$options : array<string|int, mixed>|Traversable
Tags
throws
InvalidArgumentException
Return values
StandardAutoloader

loadClass()

Load a class, based on its type (namespaced or prefixed)

protected loadClass(string $class, string $type) : bool|string
Parameters
$class : string
$type : string
Tags
throws
InvalidArgumentException
Return values
bool|string

normalizeDirectory()

Normalize the directory to include a trailing directory separator

protected normalizeDirectory(string $directory) : string
Parameters
$directory : string
Return values
string

transformClassNameToFilename()

Transform the class name to a filename

protected transformClassNameToFilename(string $class, string $directory) : string
Parameters
$class : string
$directory : string
Return values
string

        
On this page

Search results