$autoloader
$autoloader : \CodeIgniter\Autoloader\Autoloader
The Autoloader to use.
Class FileLocator
Allows loading non-class files in a namespaced manner. Works with Helpers, Views, etc.
$autoloader : \CodeIgniter\Autoloader\Autoloader
The Autoloader to use.
__construct(\CodeIgniter\Autoloader\Autoloader $autoloader)
Constructor
\CodeIgniter\Autoloader\Autoloader | $autoloader |
locateFile(string $file, string $folder = null, string $ext = 'php') : string|false
Attempts to locate a file by examining the name for a namespace and looking through the PSR-4 namespaced files that we know about.
string | $file | The namespaced file to locate |
string | $folder | The folder within the namespace that we should look for the file. |
string | $ext | The file extension the file should have. |
The path to the file, or false if not found.
search(string $path, string $ext = 'php') : array
Searches through all of the defined namespaces looking for a file.
Returns an array of all found locations for the defined file.
Example:
$locator->search('Config/Routes.php'); // Assuming PSR4 namespaces include foo and bar, might return: [ 'app/Modules/foo/Config/Routes.php', 'app/Modules/bar/Config/Routes.php', ]
string | $path | |
string | $ext |
legacyLocate(string $file, string|null $folder = null) : string|false
Checks the application folder to see if the file can be found.
Only for use with filenames that DO NOT include namespacing.
string | $file | |
string|null | $folder |
The path to the file, or false if not found.
Loading…