You are here

public function KernelInterface::locateResource in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/KernelInterface.php \Symfony\Component\HttpKernel\KernelInterface::locateResource()

Returns the file path for a given resource.

A Resource can be a file or a directory.

The resource name must follow the following pattern:

"@BundleName/path/to/a/file.something"

where BundleName is the name of the bundle and the remaining part is the relative path in the bundle.

If $dir is passed, and the first segment of the path is "Resources", this method will look for a file named:

$dir/<BundleName>/path/without/Resources

before looking in the bundle resource folder.

Parameters

string $name A resource name to locate:

string $dir A directory where to look for the resource first:

bool $first Whether to return the first path or paths for all matching bundles:

Return value

string|array The absolute path of the resource or an array if $first is false

Throws

\InvalidArgumentException if the file cannot be found or the name is not valid

\RuntimeException if the name contains invalid/unsafe characters

1 method overrides KernelInterface::locateResource()
Kernel::locateResource in vendor/symfony/http-kernel/Kernel.php

File

vendor/symfony/http-kernel/KernelInterface.php, line 111

Class

KernelInterface
The Kernel is the heart of the Symfony system.

Namespace

Symfony\Component\HttpKernel

Code

public function locateResource($name, $dir = null, $first = true);