You are here

function xautoload_Plugin_Interface::findFile in X Autoload 7.2

Find the file for a class that in PSR-0 or PEAR would be in $psr_0_root . '/' . $first_part . $second_part

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) $first_part = "Some/Namespace/" $second_part = "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 $first_part: The key that this plugin was registered with. With trailing DIRECTORY_SEPARATOR.

string $second_part: Second part of the canonical path, ending with '.php'.

5 methods override xautoload_Plugin_Interface::findFile()
xautoload_Plugin_checkIncludePath::findFile in lib/Plugin/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_Plugin_checkNothing::findFile in lib/Plugin/checkNothing.php
Expect a class Aaa_Bbb_Ccc_Ddd to be in Aaa/Bbb/Ccc/Ddd.php, but consider the PHP include_path setting.
xautoload_Plugin_DrupalExtensionLibPrefixDeep::findFile in lib/Plugin/DrupalExtensionLibPrefixDeep.php
The way this plugin is registered, it will only ever be called if the class is not within a namespace. This means, all the DIRECTORY_SEPARATOR in the $path parameter were underscores before.
xautoload_Plugin_DrupalExtensionLibPSR0::findFile in lib/Plugin/DrupalExtensionLibPSR0.php
The way this plugin is registered, it will only ever be called if the class is within the \Drupal\ namespace. All the DIRECTORY_SEPARATOR in the $path parameter were namespace separators before.
xautoload_Plugin_DrupalSimpletest::findFile in lib/Plugin/DrupalSimpletest.php
Expect a class Drupal\(module)\Tests\SomeTest to be in (module dir)/lib/Drupal/(module)/Tests/SomeTest.php, but consider the PHP include_path setting.

File

lib/Plugin/Interface.php, line 44

Class

xautoload_Plugin_Interface
X Autoload plugins are for:

Code

function findFile($api, $first_part, $second_part);