PHP Class Symfony\Component\ClassLoader\ClassCollectionLoader

Author: Fabien Potencier ([email protected])
ファイルを表示 Open project: symfony/class-loader Class Usage Examples

Public Methods

Method Description
enableTokenizer ( $bool ) This method is only useful for testing.
fixNamespaceDeclarations ( string $source ) : string Adds brackets around each namespace if it's not already the case.
inline ( array $classes, string $cache, array $excluded ) : array Generates a file where classes and their parents are inlined.
load ( array $classes, string $cacheDir, string $name, boolean $autoReload, boolean $adaptive = false, string $extension = '.php' ) Loads a list of classes and caches them in one big file.

Private Methods

Method Description
compressCode ( string $code ) : string Strips leading & trailing ws, multiple EOL, multiple ws.
computeTraitDeps ( ReflectionClass $class )
getClassHierarchy ( ReflectionClass $class )
getInterfaces ( ReflectionClass $class )
getOrderedClasses ( array $classes ) : ReflectionClass[] Gets an ordered array of passed classes including all their dependencies.
resolveDependencies ( array $tree, ReflectionClass $node, ArrayObject $resolved = null, ArrayObject $unresolved = null ) : ArrayObject Dependencies resolution.
writeCacheFile ( string $file, string $content ) Writes a cache file.

Method Details

enableTokenizer() public static method

This method is only useful for testing.
public static enableTokenizer ( $bool )

fixNamespaceDeclarations() public static method

Adds brackets around each namespace if it's not already the case.
public static fixNamespaceDeclarations ( string $source ) : string
$source string Namespace string
return string Namespaces with brackets

inline() public static method

Generates a file where classes and their parents are inlined.
public static inline ( array $classes, string $cache, array $excluded ) : array
$classes array An array of classes to load
$cache string The file where classes are inlined
$excluded array An array of classes that won't be inlined
return array The source map of inlined classes, with classes as keys and files as values

load() public static method

Loads a list of classes and caches them in one big file.
public static load ( array $classes, string $cacheDir, string $name, boolean $autoReload, boolean $adaptive = false, string $extension = '.php' )
$classes array An array of classes to load
$cacheDir string A cache directory
$name string The cache name prefix
$autoReload boolean Whether to flush the cache when the cache is stale or not
$adaptive boolean Whether to remove already declared classes or not
$extension string File extension of the resulting file