apidoc
[ class tree: apidoc ] [ index: apidoc ] [ all elements ]

Class: Autoload

Source Location: /PHP_CodeSniffer-3.1.1/autoload.php

Class Overview


Autoloads files for PHP_CodeSniffer and tracks what has been loaded.


Author(s):

Copyright:

  • 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)

Methods


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.



[ Top ]


Method Detail

addSearchPath   [line 213]

void addSearchPath( string $path, [string $nsPrefix = ''])

Adds a directory to search during autoloading.
  • Access: public

Parameters:

string   $path   —  The path to the directory to search.
string   $nsPrefix   —  The namespace prefix used by files under this path.

[ Top ]

getLoadedClasses   [line 263]

array

Gets the mapping of file names to class names.
  • Return: string>
  • Access: public

[ Top ]

getLoadedClassName   [line 228]

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.

[ Top ]

getLoadedFileName   [line 247]

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.

[ Top ]

getLoadedFiles   [line 275]

array

Gets the mapping of class names to file names.
  • Return: string>
  • Access: public

[ Top ]

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.

  • Access: public

Parameters:

string   $class   —  The name of the class to load.

[ Top ]

loadFile   [line 150]

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.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:27:15 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.