class FileViewFinder implements ViewFinderInterface (View source)

Properties

protected Filesystem $files

The filesystem instance.

protected string[] $paths

The array of active view paths.

protected array<string,string> $views

The array of views that have been located.

protected array<string,array> $hints

The namespace to file path hints.

protected string[] $extensions

Register a view extension with the finder.

Methods

__construct(Filesystem $files, array $paths, array|null $extensions = null)

Create a new file view loader instance.

string
find(string $name)

Get the fully qualified location of the view.

string
findNamespacedView(string $name)

Get the path to a template with a named path.

string[]
parseNamespaceSegments(string $name)

Get the segments of a template with a named path.

string
findInPaths(string $name, string|string[] $paths)

Find the given view in the list of paths.

string[]
getPossibleViewFiles(string $name)

Get an array of possible view files.

void
addLocation(string $location)

Add a location to the finder.

void
prependLocation(string $location)

Prepend a location to the finder.

string
resolvePath(string $path)

Resolve the path.

void
addNamespace(string $namespace, string|array $hints)

Add a namespace hint to the finder.

void
prependNamespace(string $namespace, string|array $hints)

Prepend a namespace hint to the finder.

void
replaceNamespace(string $namespace, string|array $hints)

Replace the namespace hints for the given namespace.

void
addExtension(string $extension)

Register an extension with the view finder.

bool
hasHintInformation(string $name)

Returns whether or not the view name has any hint information.

void
flush()

Flush the cache of located views.

getFilesystem()

Get the filesystem instance.

$this
setPaths(string[] $paths)

Set the active view paths.

string[]
getPaths()

Get the active view paths.

array<string,string>
getViews()

Get the views that have been located.

array<string,array>
getHints()

Get the namespace to file path hints.

string[]
getExtensions()

Get registered extensions.

Details

__construct(Filesystem $files, array $paths, array|null $extensions = null)

Create a new file view loader instance.

Parameters

Filesystem $files
array $paths
array|null $extensions

string find(string $name)

Get the fully qualified location of the view.

Parameters

string $name

Return Value

string

protected string findNamespacedView(string $name)

Get the path to a template with a named path.

Parameters

string $name

Return Value

string

protected string[] parseNamespaceSegments(string $name)

Get the segments of a template with a named path.

Parameters

string $name

Return Value

string[]

Exceptions

InvalidArgumentException

protected string findInPaths(string $name, string|string[] $paths)

Find the given view in the list of paths.

Parameters

string $name
string|string[] $paths

Return Value

string

Exceptions

InvalidArgumentException

protected string[] getPossibleViewFiles(string $name)

Get an array of possible view files.

Parameters

string $name

Return Value

string[]

void addLocation(string $location)

Add a location to the finder.

Parameters

string $location

Return Value

void

void prependLocation(string $location)

Prepend a location to the finder.

Parameters

string $location

Return Value

void

protected string resolvePath(string $path)

Resolve the path.

Parameters

string $path

Return Value

string

void addNamespace(string $namespace, string|array $hints)

Add a namespace hint to the finder.

Parameters

string $namespace
string|array $hints

Return Value

void

void prependNamespace(string $namespace, string|array $hints)

Prepend a namespace hint to the finder.

Parameters

string $namespace
string|array $hints

Return Value

void

void replaceNamespace(string $namespace, string|array $hints)

Replace the namespace hints for the given namespace.

Parameters

string $namespace
string|array $hints

Return Value

void

void addExtension(string $extension)

Register an extension with the view finder.

Parameters

string $extension

Return Value

void

bool hasHintInformation(string $name)

Returns whether or not the view name has any hint information.

Parameters

string $name

Return Value

bool

void flush()

Flush the cache of located views.

Return Value

void

Filesystem getFilesystem()

Get the filesystem instance.

Return Value

Filesystem

$this setPaths(string[] $paths)

Set the active view paths.

Parameters

string[] $paths

Return Value

$this

string[] getPaths()

Get the active view paths.

Return Value

string[]

array<string,string> getViews()

Get the views that have been located.

Return Value

array<string,string>

array<string,array> getHints()

Get the namespace to file path hints.

Return Value

array<string,array>

string[] getExtensions()

Get registered extensions.

Return Value

string[]