Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ClassLoader.php

function ClassLoader::findFile

Same name in this branch
  1. 11.1.x vendor/composer/ClassLoader.php \Composer\Autoload\ClassLoader::findFile()

Finds the path to the file where the class is defined.

Parameters

string $class The name of the class:

Return value

string|false The path if found, false otherwise

2 calls to ClassLoader::findFile()
ClassLoader::loadClass in vendor/composer/ClassLoader.php
Loads the given class or interface.
ClassLoader::loadClass in vendor/composer/composer/src/Composer/Autoload/ClassLoader.php
Loads the given class or interface.

File

vendor/composer/composer/src/Composer/Autoload/ClassLoader.php, line 442

Class

ClassLoader
ClassLoader implements a PSR-0, PSR-4 and classmap class loader.

Namespace

Composer\Autoload

Code

public function findFile($class) {
    // class map lookup
    if (isset($this->classMap[$class])) {
        return $this->classMap[$class];
    }
    if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
        return false;
    }
    if (null !== $this->apcuPrefix) {
        $file = apcu_fetch($this->apcuPrefix . $class, $hit);
        if ($hit) {
            return $file;
        }
    }
    $file = $this->findFileWithExtension($class, '.php');
    // Search for Hack files if we are running on HHVM
    if (false === $file && defined('HHVM_VERSION')) {
        $file = $this->findFileWithExtension($class, '.hh');
    }
    if (null !== $this->apcuPrefix) {
        apcu_add($this->apcuPrefix . $class, $file);
    }
    if (false === $file) {
        // Remember that this class does not exist.
        $this->missingClasses[$class] = true;
    }
    return $file;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal