php/WP_CLI/Autoloader.php
public function autoload( $class ) {

		// Iterate over namespaces to find a match.
		foreach ( $this->namespaces as $namespace ) {

			// Move on if the object does not belong to the current namespace.
			if ( 0 !== strpos( $class, $namespace['root'] ) ) {
				continue;
			}

			// Remove namespace root level to correspond with root filesystem, and
			// replace the namespace separator "\" by the system-dependent directory separator.
			$filename = str_replace(
				array( $namespace['root'], '\\' ),
				array( '', DIRECTORY_SEPARATOR ),
				$class
			);

			// Remove a leading backslash from the class name.
			$filename = $this->remove_leading_backslash( $filename );

			// Change to lower case if requested.
			if ( $namespace['lowercase'] ) {
				$filename = strtolower( $filename );
			}

			// Change underscores into hyphens if requested.
			if ( $namespace['underscores'] ) {
				$filename = str_replace( '_', '-', $filename );
			}

			// Add base_dir, prefix and suffix.
			$filepath = $namespace['base_dir']
				. $namespace['prefix']
				. $filename
				. $namespace['suffix'];

			// Throw an exception if the file does not exist or is not readable.
			if ( is_readable( $filepath ) ) {
				require_once $filepath;
			}
		}
	}
public function autoload( $class ) {

		// Iterate over namespaces to find a match.
		foreach ( $this->namespaces as $namespace ) {

			// Move on if the object does not belong to the current namespace.
			if ( 0 !== strpos( $class, $namespace['root'] ) ) {
				continue;
			}

			// Remove namespace root level to correspond with root filesystem, and
			// replace the namespace separator "\" by the system-dependent directory separator.
			$filename = str_replace(
				array( $namespace['root'], '\\' ),
				array( '', DIRECTORY_SEPARATOR ),
				$class
			);

			// Remove a leading backslash from the class name.
			$filename = $this->remove_leading_backslash( $filename );

			// Change to lower case if requested.
			if ( $namespace['lowercase'] ) {
				$filename = strtolower( $filename );
			}

			// Change underscores into hyphens if requested.
			if ( $namespace['underscores'] ) {
				$filename = str_replace( '_', '-', $filename );
			}

			// Add base_dir, prefix and suffix.
			$filepath = $namespace['base_dir']
				. $namespace['prefix']
				. $filename
				. $namespace['suffix'];

			// Throw an exception if the file does not exist or is not readable.
			if ( is_readable( $filepath ) ) {
				require_once $filepath;
			}
		}
	}
public function autoload ( $ class ) { // Iterate over namespaces to find a match. foreach ( $ this -> namespaces as $ namespace ) { // Move on if the object does not belong to the current namespace. if ( 0 !== strpos ( $ class , $ namespace [ 'root' ] ) ) { continue ; } // Remove namespace root level to correspond with root filesystem, and // replace the namespace separator "\" by the system-dependent directory separator. $ filename = str_replace ( array ( $ namespace [ 'root' ] , '\\' ) , array ( '' , DIRECTORY_SEPARATOR ) , $ class ) ; // Remove a leading backslash from the class name. $ filename = $ this -> remove_leading_backslash ( $ filename ) ; // Change to lower case if requested. if ( $ namespace [ 'lowercase' ] ) { $ filename = strtolower ( $ filename ) ; } // Change underscores into hyphens if requested. if ( $ namespace [ 'underscores' ] ) { $ filename = str_replace ( '_' , '-' , $ filename ) ; } // Add base_dir, prefix and suffix. $ filepath = $ namespace [ 'base_dir' ] . $ namespace [ 'prefix' ] . $ filename . $ namespace [ 'suffix' ] ; // Throw an exception if the file does not exist or is not readable. if ( is_readable ( $ filepath ) ) { require_once $ filepath ; } } }
The autoload function that gets registered with the SPL Autoloader
system.

@param string $class The class that got requested by the spl_autoloader.
The autoload function that gets registered with the SPL Autoloader system .