You are here

function xautoload_ServiceFactory::finder in X Autoload 7.3

The class finder (alias for 'classFinder').

Parameters

xautoload_Container_LazyServices $services:

Return value

xautoload_ClassFinder_Interface Object that can find classes, and provides methods to register namespaces and prefixes. Notes:

  • The findClass() method expects an InjectedAPI argument.
  • namespaces are only supported since PHP 5.3

File

lib/ServiceFactory.php, line 141

Class

xautoload_ServiceFactory

Code

function finder($services) {
  if (version_compare(PHP_VERSION, '5.3') >= 0) {

    // Create a finder with namespace support.
    return new xautoload_ClassFinder_NamespaceOrPrefix();
  }
  else {

    // Create a finder without namespaces support.
    return new xautoload_ClassFinder_Prefix();
  }
}