interface InjectedApiInterface in X Autoload 7.5
Same name and namespace in other branches
- 7.4 lib/ClassFinder/InjectedApi/InjectedApiInterface.php \Drupal\xautoload\ClassFinder\InjectedApi\InjectedApiInterface
To help testability, we use an injected API instead of just a return value. The injected API can be mocked to provide a mocked file_exists(), and to monitor all suggested candidates, not just the correct return value.
Hierarchy
- interface \Drupal\xautoload\ClassFinder\InjectedApi\InjectedApiInterface
Expanded class hierarchy of InjectedApiInterface
All classes that implement InjectedApiInterface
5 files declare their use of InjectedApiInterface
- DrupalCoreRegistryPlugin.php in src/
ClassFinder/ Plugin/ DrupalCoreRegistryPlugin.php - FinderPluginInterface.php in src/
ClassFinder/ Plugin/ FinderPluginInterface.php - GenericPrefixMap.php in src/
ClassFinder/ GenericPrefixMap.php - Interface.php in legacy/
lib/ FinderPlugin/ Interface.php - LibrariesFinderPlugin.php in src/
Libraries/ LibrariesFinderPlugin.php
File
- src/
ClassFinder/ InjectedApi/ InjectedApiInterface.php, line 11
Namespace
Drupal\xautoload\ClassFinder\InjectedApiView source
interface InjectedApiInterface {
/**
* This is done in the injected api object, so we can easily provide a mock
* implementation.
*/
function is_dir($dir);
/**
* Get the name of the class we are looking for.
*
* @return string
* The class we are looking for.
*/
function getClass();
/**
* Suggest a file that, if the file exists,
* has to declare the class we are looking for.
* Only keep the class on success.
*
* @param string $file
* The file that is supposed to declare the class.
*
* @return bool
* TRUE, if the file exists.
* FALSE, otherwise.
*/
function suggestFile($file);
/**
* Same as suggestFile(), but skip the file_exists(),
* assuming that we already know the file exists.
*
* This could make sense if a plugin already did the file_exists() check.
*
* @param string $file
* The file that is supposed to declare the class.
*
* @return bool
* TRUE, if the file was found - which is always.
*/
function suggestFile_skipFileExists($file);
/**
* Same as suggestFile(), but assume that file_exists() returns TRUE.
*
* @param string $file
* The file that is supposed to declare the class.
*
* @return bool
* TRUE, if the file was found - which is always.
*/
function suggestFile_checkNothing($file);
/**
* Same as suggestFile(), but check the full PHP include path.
*
* @param string $file
* The file that is supposed to declare the class.
*
* @return bool
* TRUE, if the file exists.
* FALSE, otherwise.
*/
function suggestFile_checkIncludePath($file);
/**
* Suggest a file that MUST exists, and that MAY declare the class we are
* looking for.
*
* This is useful if a plugin already did the is_file() check by itself.
*
* @param string $file
* The file that is supposed to declare the class.
*
* @return boolean|NULL
* TRUE, if we are not interested in further candidates.
* FALSE|NULL, if we are interested in further candidates.
*/
function guessFile($file);
/**
* Suggest a file that MAY exist, and that MAY declare the class we are
* looking for.
*
* This is useful if a plugin already did the is_file() check by itself.
*
* @param string $file
* The file that is supposed to declare the class.
*
* @return boolean|NULL
* TRUE, if we are not interested in further candidates.
* FALSE|NULL, if we are interested in further candidates.
*/
function guessPath($file);
/**
* Suggest a file that MUST exist, and if so, MUST declare the class we are
* looking for.
*
* This is useful if a plugin already did the is_file() check by itself.
*
* @param string $file
* The file that is supposed to declare the class.
*
* @return boolean|NULL
* TRUE, if we are not interested in further candidates.
* FALSE|NULL, if we are interested in further candidates.
*/
function claimFile($file);
/**
* Suggest a file that MAY exist, and if so, MUST declare the class we are
* looking for.
*
* This is useful if a plugin already did the is_file() check by itself.
*
* @param string $file
* The file that is supposed to declare the class.
*
* @return boolean|NULL
* TRUE, if we are not interested in further candidates.
* FALSE|NULL, if we are interested in further candidates.
*/
function claimPath($file);
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
InjectedApiInterface:: |
function | Suggest a file that MUST exist, and if so, MUST declare the class we are looking for. | 3 | |
InjectedApiInterface:: |
function | Suggest a file that MAY exist, and if so, MUST declare the class we are looking for. | 3 | |
InjectedApiInterface:: |
function | Get the name of the class we are looking for. | 1 | |
InjectedApiInterface:: |
function | Suggest a file that MUST exists, and that MAY declare the class we are looking for. | 3 | |
InjectedApiInterface:: |
function | Suggest a file that MAY exist, and that MAY declare the class we are looking for. | 3 | |
InjectedApiInterface:: |
function | This is done in the injected api object, so we can easily provide a mock implementation. | 1 | |
InjectedApiInterface:: |
function | Suggest a file that, if the file exists, has to declare the class we are looking for. Only keep the class on success. | 3 | |
InjectedApiInterface:: |
function | Same as suggestFile(), but check the full PHP include path. | 3 | |
InjectedApiInterface:: |
function | Same as suggestFile(), but assume that file_exists() returns TRUE. | 3 | |
InjectedApiInterface:: |
function | Same as suggestFile(), but skip the file_exists(), assuming that we already know the file exists. | 3 |