function xautoload_FinderPlugin_Interface::findFile in X Autoload 7.3
Same name and namespace in other branches
- 7.5 legacy/lib/FinderPlugin/Interface.php \xautoload_FinderPlugin_Interface::findFile()
- 7.4 legacy/lib/FinderPlugin/Interface.php \xautoload_FinderPlugin_Interface::findFile()
Find the file for a class that in PSR-0 or PEAR would be in $psr_0_root . '/' . $path_fragment . $path_suffix
E.g.:
- The class we look for is Some\Namespace\Some\Class
- The file is actually in "exotic/location.php". This is not following PSR-0 or PEAR standard, so we need a plugin.
-> The class finder will transform the class name to "Some/Namespace/Some/Class.php"
- The plugin was registered for the namespace "Some\Namespace". This is because all those exotic classes all begin with Some\Namespace\
-> The arguments will be: ($api = the API object, see below) $path_fragment = "Some/Namespace/" $path_suffix = "Some/Class.php" $api->getClass() gives the original class name, if we still need it. -> We are supposed to: if ($api->suggestFile('exotic/location.php')) { return TRUE; }
Parameters
xautoload_InjectedAPI_findFile $api: An object with a suggestFile() method. We are supposed to suggest files until suggestFile() returns TRUE, or we have no more suggestions.
string $path_fragment: The key that this plugin was registered with. With trailing DIRECTORY_SEPARATOR.
string $path_suffix: Second part of the canonical path, ending with '.php'.
int|string $id: Id under which the plugin was registered. This may be a numeric id, or a string key.
Return value
bool|NULL TRUE, if the file was found. FALSE, otherwise.
2 methods override xautoload_FinderPlugin_Interface::findFile()
- xautoload_FinderPlugin_CheckIncludePath::findFile in lib/
FinderPlugin/ CheckIncludePath.php - Expect a class Aaa_Bbb_Ccc_Ddd to be in Aaa/Bbb/Ccc/Ddd.php, but consider the PHP include_path setting.
- xautoload_FinderPlugin_Psr4::findFile in lib/
FinderPlugin/ Psr4.php
File
- lib/
FinderPlugin/ Interface.php, line 51
Class
- xautoload_FinderPlugin_Interface
- X Autoload plugins are for:
Code
function findFile($api, $path_fragment, $path_suffix, $id = NULL);