Метод | Описание | |
---|---|---|
__construct ( array $moduleNames = [] ) | Creates a new graph. | |
addDependency ( string $moduleName, string $dependency ) | Adds a dependency from one to another module. | |
addModuleName ( string $moduleName ) | Adds a module name to the graph. | |
addModuleNames ( array $moduleNames ) | Adds a list of module names to the graph. | |
forModules ( |
Creates an override graph for the given modules. | |
getModuleNames ( ) : array | Returns all module names in the graph. | |
getPath ( string $moduleName, string $dependency ) : null | string[] | Returns the path from a module name to a dependency. | |
getSortedModuleNames ( array $namesToSort = [] ) : string[] | Returns the sorted module names. | |
hasDependency ( string $moduleName, string $dependency, boolean $recursive = true ) : boolean | Returns whether a module directly depends on another module. | |
hasModuleName ( string $moduleName ) : boolean | Returns whether a module name exists in the graph. | |
hasPath ( string $moduleName, string $dependency ) : boolean | Returns whether a path exists from a module to a dependency. | |
removeDependency ( string $moduleName, string $dependency ) | Removes a dependency from one to another module. |
Метод | Описание | |
---|---|---|
getPathDFS ( string $moduleName, string $dependency, array &$reversePath = [] ) : boolean | Finds a path between modules using Depth-First Search. | |
sortModulesDFS ( string $currentName, array &$namesToSort, array &$output ) | Topologically sorts the given module name into the output array. |
public __construct ( array $moduleNames = [] ) | ||
$moduleNames | array | The module names stored in the nodes of the graph. |
public addDependency ( string $moduleName, string $dependency ) | ||
$moduleName | string | The module name. |
$dependency | string | The name of the dependency. |
public addModuleName ( string $moduleName ) | ||
$moduleName | string | The module name. |
public addModuleNames ( array $moduleNames ) | ||
$moduleNames | array | The module names. |
public static forModules ( |
||
$modules | The modules to load. | |
Результат | static | The created override graph. |
public getModuleNames ( ) : array | ||
Результат | array | All module names in the graph. |
public getSortedModuleNames ( array $namesToSort = [] ) : string[] | ||
$namesToSort | array | The module names which should be sorted. |
Результат | string[] | The sorted module names. |
public hasDependency ( string $moduleName, string $dependency, boolean $recursive = true ) : boolean | ||
$moduleName | string | The module name. |
$dependency | string | The name of the dependency. |
$recursive | boolean | Whether to take recursive dependencies into account. |
Результат | boolean | Whether an edge exists from the origin to the target module. |
public hasModuleName ( string $moduleName ) : boolean | ||
$moduleName | string | The module name. |
Результат | boolean | Whether the module name exists. |
public removeDependency ( string $moduleName, string $dependency ) | ||
$moduleName | string | The module name. |
$dependency | string | The name of the dependency. |