class FileLocator extends FileLocator

FileLocator uses the KernelInterface to locate resources in bundles.

Properties

protected $paths from FileLocator

Methods

__construct(KernelInterface $kernel, string $path = null, string|string[] $paths = [])

No description

string|array
locate($file, string|null $currentPath = null, bool $first = true)

Returns a full path for a given file name.

Details

at line 32
__construct(KernelInterface $kernel, string $path = null, string|string[] $paths = [])

Parameters

KernelInterface $kernel A KernelInterface instance
string $path The path the global resource directory
string|string[] $paths A path or an array of paths where to look for resources

at line 46
string|array locate($file, string|null $currentPath = null, bool $first = true)

Returns a full path for a given file name.

Parameters

$file
string|null $currentPath The current path
bool $first Whether to return the first occurrence or an array of filenames

Return Value

string|array The full path to the file or an array of file paths

Exceptions

InvalidArgumentException If $name is empty
FileLocatorFileNotFoundException If a file is not found