Documentation

ClassMapGenerator
in package

ClassMapGenerator

Tags
author

Gyula Sallai salla016@gmail.com

author

Jordi Boggiano j.boggiano@seld.be

Table of Contents

createMap()  : array<string|int, mixed>
Iterate over all files in the given directory searching for classes
dump()  : mixed
Generate a class map file
filterByNamespace()  : array<string|int, mixed>
Remove classes which could not have been loaded by namespace autoloaders
findClasses()  : array<string|int, mixed>
Extract the classes in the given file

Methods

createMap()

Iterate over all files in the given directory searching for classes

public static createMap(Iterator|string $path[, string $excluded = null ][, IOInterface $io = null ][, string $namespace = null ][, string $autoloadType = null ][, mixed &$scannedFiles = array() ]) : array<string|int, mixed>
Parameters
$path : Iterator|string

The path to search in or an iterator

$excluded : string = null

Regex that matches against the file path that exclude from the classmap.

$io : IOInterface = null

IO object

$namespace : string = null

Optional namespace prefix to filter by

$autoloadType : string = null

psr-0|psr-4 Optional autoload standard to use mapping rules

$scannedFiles : mixed = array()
Tags
throws
RuntimeException

When the path is neither an existing file nor directory

Return values
array<string|int, mixed>

A class map array

dump()

Generate a class map file

public static dump(Traversable $dirs, string $file) : mixed
Parameters
$dirs : Traversable

Directories or a single path to search in

$file : string

The name of the class map file

Return values
mixed

filterByNamespace()

Remove classes which could not have been loaded by namespace autoloaders

private static filterByNamespace(array<string|int, mixed> $classes, string $filePath, string $baseNamespace, string $namespaceType, string $basePath, IOInterface $io) : array<string|int, mixed>
Parameters
$classes : array<string|int, mixed>

found classes in given file

$filePath : string

current file

$baseNamespace : string

prefix of given autoload mapping

$namespaceType : string

psr-0|psr-4

$basePath : string

root directory of given autoload mapping

$io : IOInterface

IO object

Return values
array<string|int, mixed>

valid classes

findClasses()

Extract the classes in the given file

private static findClasses(string $path) : array<string|int, mixed>
Parameters
$path : string

The file to check

Tags
throws
RuntimeException
Return values
array<string|int, mixed>

The found classes

Search results