Class: Autoload
Source Location: /PHP_CodeSniffer-3.0.1/autoload.php
Autoloads files for PHP_CodeSniffer and tracks what has been loaded.
Author(s):
Copyright:
- 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
Inherited Variables
Inherited Methods
Class Details
[line
20]
Autoloads files for PHP_CodeSniffer and tracks what has been loaded.
Due to different namespaces being used for custom coding standards, the autoloader keeps track of what class is loaded after a file is included, even if the file is ultimately included by another autoloader (such as composer).
This allows PHP_CodeSniffer to request the class name after loading a class when it only knows the filename, without having to parse the file to find it.
Method Detail
addSearchPath [line 207]
void addSearchPath(
string
$path, [string
$nsPrefix = ''])
Adds a directory to search during autoloading.
Parameters:
string
$path
—
The path to the directory to search.
string
$nsPrefix
—
The namespace prefix used by files under this path.
getLoadedClasses [line 257]
Gets the mapping of file names to class names.
- Return: string>
- Access: public
getLoadedClassName [line 222]
string getLoadedClassName(
string
$path)
Gets the class name for the given file path.
- Throws: \Exception If the file path has not been loaded.
- Access: public
Parameters:
string
$path
—
The name of the file.
getLoadedFileName [line 241]
string getLoadedFileName(
string
$class)
Gets the file path for the given class name.
- Throws: \Exception If the class name has not been loaded
- Access: public
Parameters:
string
$class
—
The name of the class.
getLoadedFiles [line 269]
Gets the mapping of class names to file names.
- Return: string>
- Access: public
load [line 64]
bool load(
string
$class)
Loads a class.
This method only loads classes that exist in the PHP_CodeSniffer namespace. All other classes are ignored and loaded by subsequent autoloaders.
Parameters:
string
$class
—
The name of the class to load.
loadFile [line 144]
string loadFile(
string
$path)
Includes a file and tracks what class or interface was loaded as a result.
- Return: The fully qualified name of the class in the loaded file.
- Access: public
Parameters:
string
$path
—
The path of the file to load.
Documentation generated on 2019年3月11日 14:17:42 -0400 by
phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.