Documentation

ClassLoader
in package

Loader class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2023 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
3.1.0

Table of Contents

$classMap  : array<string|int, mixed>
Class map array
$classMapAuthoritative  : bool
Class map authoritative flag
$psr0  : array<string|int, mixed>
PSR-0 prefixes
$psr4  : array<string|int, mixed>
PSR-4 prefixes
__construct()  : mixed
Constructor
__invoke()  : void
Invoke the class
add()  : ClassLoader
Add a PSR-0 prefix and directory location to the autoloader instance
addClassMap()  : ClassLoader
Add a class map array
addClassMapFromDir()  : ClassLoader
Generate and add a class map from directory
addClassMapFromFile()  : ClassLoader
Add a class map from file
addPsr0()  : ClassLoader
Alias to add()
addPsr4()  : ClassLoader
Add a PSR-4 prefix and directory location to the autoloader instance
findFile()  : mixed
Find the class file
getClassMap()  : array<string|int, mixed>
Get the class map array
getPsr0Prefixes()  : array<string|int, mixed>
Get the PSR-0 prefixes
getPsr4Prefixes()  : array<string|int, mixed>
Get the PSR-4 prefixes
isClassMapAuthoritative()  : bool
Determine if the class map is the authoritative loader
loadClass()  : bool
Find and load the class file
register()  : ClassLoader
Register this instance with the autoload stack
set()  : ClassLoader
Alias to add()
setClassMapAuthoritative()  : ClassLoader
Set the class map as the authoritative loader, halting any searches via prefixes
setPsr0()  : ClassLoader
Alias to add()
setPsr4()  : ClassLoader
Alias to addPsr4()
unregister()  : ClassLoader
Unregister this instance with the autoload stack

Properties

$classMap

Class map array

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

$classMapAuthoritative

Class map authoritative flag

protected bool $classMapAuthoritative = false

$psr0

PSR-0 prefixes

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

$psr4

PSR-4 prefixes

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

Methods

__construct()

Constructor

public __construct([bool $self = true ][, bool $prepend = false ][, bool $throw = true ]) : mixed

Instantiate the class loader object

Parameters
$self : bool = true
$prepend : bool = false
$throw : bool = true
Return values
mixed

__invoke()

Invoke the class

public __invoke(string $class) : void
Parameters
$class : string
Return values
void

add()

Add a PSR-0 prefix and directory location to the autoloader instance

public add(string $prefix, string $directory[, bool $prepend = false ]) : ClassLoader
Parameters
$prefix : string
$directory : string
$prepend : bool = false
Tags
throws
Exception
Return values
ClassLoader

addPsr0()

Alias to add()

public addPsr0(string $prefix, string $directory[, bool $prepend = false ]) : ClassLoader
Parameters
$prefix : string
$directory : string
$prepend : bool = false
Return values
ClassLoader

addPsr4()

Add a PSR-4 prefix and directory location to the autoloader instance

public addPsr4(string $prefix, string $directory[, bool $prepend = false ]) : ClassLoader
Parameters
$prefix : string
$directory : string
$prepend : bool = false
Tags
throws
Exception
Return values
ClassLoader

findFile()

Find the class file

public findFile(string $class) : mixed
Parameters
$class : string
Return values
mixed

getClassMap()

Get the class map array

public getClassMap() : array<string|int, mixed>
Return values
array<string|int, mixed>

getPsr0Prefixes()

Get the PSR-0 prefixes

public getPsr0Prefixes() : array<string|int, mixed>
Return values
array<string|int, mixed>

getPsr4Prefixes()

Get the PSR-4 prefixes

public getPsr4Prefixes() : array<string|int, mixed>
Return values
array<string|int, mixed>

isClassMapAuthoritative()

Determine if the class map is the authoritative loader

public isClassMapAuthoritative() : bool
Return values
bool

loadClass()

Find and load the class file

public loadClass(string $class) : bool
Parameters
$class : string
Return values
bool

register()

Register this instance with the autoload stack

public register(bool $prepend[, bool $throw = true ]) : ClassLoader
Parameters
$prepend : bool
$throw : bool = true
Return values
ClassLoader

set()

Alias to add()

public set(string $prefix, string $directory[, bool $prepend = false ]) : ClassLoader
Parameters
$prefix : string
$directory : string
$prepend : bool = false
Return values
ClassLoader

setClassMapAuthoritative()

Set the class map as the authoritative loader, halting any searches via prefixes

public setClassMapAuthoritative(bool $authoritative) : ClassLoader
Parameters
$authoritative : bool
Return values
ClassLoader

setPsr0()

Alias to add()

public setPsr0(string $prefix, string $directory[, bool $prepend = false ]) : ClassLoader
Parameters
$prefix : string
$directory : string
$prepend : bool = false
Return values
ClassLoader

setPsr4()

Alias to addPsr4()

public setPsr4(string $prefix, string $directory[, bool $prepend = false ]) : ClassLoader
Parameters
$prefix : string
$directory : string
$prepend : bool = false
Return values
ClassLoader

Search results