class DefaultFileLocator implements FileLocator (View source)

Locates the file that contains the metadata information for a given class name.

This behavior is independent of the actual content of the file. It just detects the file which is responsible for the given class name.

Properties

protected string[] $paths The paths where to look for mapping files.
protected string|null $fileExtension The file extension of mapping documents.

Methods

__construct(string|string[] $paths, string|null $fileExtension = null)

Initializes a new FileDriver that looks in the given path(s) for mapping documents and operates in the specified operating mode.

void
addPaths(array $paths)

Appends lookup paths to metadata driver.

string[]
getPaths()

Retrieves the defined metadata lookup paths.

string
getFileExtension()

Gets the file extension used to look for mapping files under.

void
setFileExtension(string|null $fileExtension)

Sets the file extension used to look for mapping files under.

string
findMappingFile(string $className)

Locates mapping file for the given class name.

string[]
getAllClassNames(string $globalBasename)

Gets all class names that are found with this file locator.

bool
fileExists(string $className)

Checks if a file can be found for this class name.

Details

__construct(string|string[] $paths, string|null $fileExtension = null)

Initializes a new FileDriver that looks in the given path(s) for mapping documents and operates in the specified operating mode.

Parameters

string|string[] $paths One or multiple paths where mapping documents can be found.
string|null $fileExtension The file extension of mapping documents, usually prefixed with a dot.

void addPaths(array $paths)

Appends lookup paths to metadata driver.

Parameters

array $paths

Return Value

void

string[] getPaths()

Retrieves the defined metadata lookup paths.

Return Value

string[]

string getFileExtension()

Gets the file extension used to look for mapping files under.

Return Value

string

void setFileExtension(string|null $fileExtension)

Sets the file extension used to look for mapping files under.

Parameters

string|null $fileExtension The file extension to set.

Return Value

void

string findMappingFile(string $className)

Locates mapping file for the given class name.

Parameters

string $className

Return Value

string

string[] getAllClassNames(string $globalBasename)

Gets all class names that are found with this file locator.

Parameters

string $globalBasename Passed to allow excluding the basename.

Return Value

string[]

bool fileExists(string $className)

Checks if a file can be found for this class name.

Parameters

string $className

Return Value

bool