SymfonyFileLocator
in package
implements
FileLocator
The Symfony File Locator makes a simplifying assumptions compared to the DefaultFileLocator. By assuming paths only contain entities of a certain namespace the mapping files consists of the short classname only.
Interfaces, Classes, Traits and Enums
- FileLocator
- Locates the file that contains the metadata information for a given class name.
Table of Contents
- $fileExtension : string|null
- File extension that is searched for.
- $paths : array<string|int, string>
- The paths where to look for mapping files.
- $prefixes : array<string|int, string>
- A map of mapping directory path to namespace prefix used to expand class shortnames.
- $nsSeparator : string
- Represents PHP namespace delimiters when looking for files
- __construct() : mixed
- addNamespacePrefixes() : void
- Adds Namespace Prefixes.
- fileExists() : bool
- Checks if a file can be found for this class name.
- findMappingFile() : string
- Locates mapping file for the given class name.
- getAllClassNames() : array<string|int, string>
- Gets all class names that are found with this file locator.
- getFileExtension() : string|null
- Gets the file extension that mapping files are suffixed with.
- getNamespacePrefixes() : array<string|int, string>
- Gets Namespace Prefixes.
- getPaths() : array<string|int, string>
- Gets all the paths that this file locator looks for mapping files.
- setFileExtension() : void
- Sets the file extension used to look for mapping files under.
Properties
$fileExtension
File extension that is searched for.
protected
string|null
$fileExtension
$paths
The paths where to look for mapping files.
protected
array<string|int, string>
$paths
= []
$prefixes
A map of mapping directory path to namespace prefix used to expand class shortnames.
protected
array<string|int, string>
$prefixes
= []
$nsSeparator
Represents PHP namespace delimiters when looking for files
private
string
$nsSeparator
Methods
__construct()
public
__construct(array<string|int, string> $prefixes[, string|null $fileExtension = null ][, string $nsSeparator = '.' ]) : mixed
Parameters
- $prefixes : array<string|int, string>
- $fileExtension : string|null = null
- $nsSeparator : string = '.'
-
String which would be used when converting FQCN to filename and vice versa. Should not be empty
Return values
mixed —addNamespacePrefixes()
Adds Namespace Prefixes.
public
addNamespacePrefixes(array<string|int, string> $prefixes) : void
Parameters
- $prefixes : array<string|int, string>
Return values
void —fileExists()
Checks if a file can be found for this class name.
public
fileExists(mixed $className) : bool
Parameters
- $className : mixed
Return values
bool —findMappingFile()
Locates mapping file for the given class name.
public
findMappingFile(mixed $className) : string
Parameters
- $className : mixed
Return values
string —getAllClassNames()
Gets all class names that are found with this file locator.
public
getAllClassNames([mixed $globalBasename = null ]) : array<string|int, string>
Parameters
- $globalBasename : mixed = null
-
Passed to allow excluding the basename.
Return values
array<string|int, string> —getFileExtension()
Gets the file extension that mapping files are suffixed with.
public
getFileExtension() : string|null
Return values
string|null —getNamespacePrefixes()
Gets Namespace Prefixes.
public
getNamespacePrefixes() : array<string|int, string>
Return values
array<string|int, string> —getPaths()
Gets all the paths that this file locator looks for mapping files.
public
getPaths() : array<string|int, string>
Return values
array<string|int, string> —setFileExtension()
Sets the file extension used to look for mapping files under.
public
setFileExtension(string $fileExtension) : void
Parameters
- $fileExtension : string
-
The file extension to set.