Psr4DirectoryLoader
extends Loader
in package
implements
DirectoryAwareLoaderInterface
FinalYes
A loader that discovers controller classes in a directory that follows PSR-4.
Tags
Table of Contents
Interfaces
- DirectoryAwareLoaderInterface
- A loader that can be scoped to a given filesystem directory.
Properties
- $env : mixed
- $resolver : mixed
- $currentDirectory : string|null
- $locator : FileLocatorInterface
Methods
- __construct() : mixed
- forDirectory() : static
- getResolver() : LoaderResolverInterface
- Gets the loader resolver.
- import() : mixed
- Imports a resource.
- load() : mixed
- Loads a resource.
- resolve() : LoaderInterface
- Finds a loader able to load an imported resource.
- setResolver() : void
- Sets the loader resolver.
- supports() : bool
- Returns whether this class supports the given resource.
- loadFromDirectory() : RouteCollection
Properties
$env
protected
mixed
$env
$resolver
protected
mixed
$resolver
$currentDirectory
private
string|null
$currentDirectory
= null
$locator read-only
private
FileLocatorInterface
$locator
Methods
__construct()
public
__construct(FileLocatorInterface $locator) : mixed
Parameters
- $locator : FileLocatorInterface
forDirectory()
public
forDirectory(string $currentDirectory) : static
Parameters
- $currentDirectory : string
Return values
staticgetResolver()
Gets the loader resolver.
public
getResolver() : LoaderResolverInterface
Return values
LoaderResolverInterfaceimport()
Imports a resource.
public
import(mixed $resource[, string|null $type = null ]) : mixed
Parameters
- $resource : mixed
- $type : string|null = null
load()
Loads a resource.
public
load(array{path: string, namespace: string} $resource[, string|null $type = null ]) : mixed
Parameters
- $resource : array{path: string, namespace: string}
- $type : string|null = null
resolve()
Finds a loader able to load an imported resource.
public
resolve(mixed $resource[, string|null $type = null ]) : LoaderInterface
Parameters
- $resource : mixed
- $type : string|null = null
Tags
Return values
LoaderInterfacesetResolver()
Sets the loader resolver.
public
setResolver(LoaderResolverInterface $resolver) : void
Parameters
- $resolver : LoaderResolverInterface
supports()
Returns whether this class supports the given resource.
public
supports(mixed $resource[, string|null $type = null ]) : bool
Parameters
- $resource : mixed
-
A resource
- $type : string|null = null
Return values
boolloadFromDirectory()
private
loadFromDirectory(string $directory, string $psr4Prefix) : RouteCollection
Parameters
- $directory : string
- $psr4Prefix : string