Documentation

FileLocator
in package
implements FileLocatorInterface

FileLocator uses an array of pre-defined paths to find files.

Tags
author

Fabien Potencier fabien@symfony.com

Interfaces, Classes and Traits

FileLocatorInterface

Table of Contents

$paths  : mixed
__construct()  : mixed
locate()  : string|array<string|int, mixed>
Returns a full path for a given file name.
isAbsolutePath()  : bool
Returns whether the file path is an absolute path.

Properties

Methods

__construct()

public __construct([string|array<string|int, string> $paths = [] ]) : mixed
Parameters
$paths : string|array<string|int, string> = []

A path or an array of paths where to look for resources

Return values
mixed

locate()

Returns a full path for a given file name.

public locate(string $name[, string|null $currentPath = null ][, bool $first = true ]) : string|array<string|int, mixed>
Parameters
$name : string

The file name to locate

$currentPath : string|null = null

The current path

$first : bool = true

Whether to return the first occurrence or an array of filenames

Return values
string|array<string|int, mixed>

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

isAbsolutePath()

Returns whether the file path is an absolute path.

private isAbsolutePath(string $file) : bool
Parameters
$file : string
Return values
bool

Search results