CommandRegistry
in package
Console command registry class
Tags
Table of Contents
Properties
- $commands : array<string|int, mixed>
- Commands
Methods
- add() : static
- Add a command
- addAll() : static
- Add commands
- addFromRoutes() : static
- Add commands from routes
- all() : array<string|int, mixed>
- Get all commands
- fromRoutes() : array<string|int, mixed>
- Build commands from routes
- get() : Command|null
- Get a command
- has() : bool
- Check if the registry has a command
- loadRoutes() : array<string|int, mixed>
- Load application commands into the route config array
- buildCommandRouteEntry() : array<string|int, mixed>|null
- Build a single route entry from a discovered command file
- detectNamespace() : string|null
- Detect the namespace declared in a PHP file
Properties
$commands
Commands
protected
array<string|int, mixed>
$commands
= []
Methods
add()
Add a command
public
add(Command $command) : static
Parameters
- $command : Command
Return values
staticaddAll()
Add commands
public
addAll(array<string|int, mixed> $commands) : static
Parameters
- $commands : array<string|int, mixed>
Return values
staticaddFromRoutes()
Add commands from routes
public
addFromRoutes(Cli $routeMatch[, string|null $scriptName = null ]) : static
Parameters
- $routeMatch : Cli
- $scriptName : string|null = null
Return values
staticall()
Get all commands
public
all() : array<string|int, mixed>
Return values
array<string|int, mixed>fromRoutes()
Build commands from routes
public
fromRoutes(Cli $routeMatch[, string|null $scriptName = null ]) : array<string|int, mixed>
Parameters
- $routeMatch : Cli
- $scriptName : string|null = null
Return values
array<string|int, mixed>get()
Get a command
public
get(string $name) : Command|null
Parameters
- $name : string
Return values
Command|nullhas()
Check if the registry has a command
public
has(string $name) : bool
Parameters
- $name : string
Return values
boolloadRoutes()
Load application commands into the route config array
public
static loadRoutes(array<string|int, mixed> $routes, string $location[, bool $prepend = true ]) : array<string|int, mixed>
Parameters
- $routes : array<string|int, mixed>
- $location : string
- $prepend : bool = true
Return values
array<string|int, mixed>buildCommandRouteEntry()
Build a single route entry from a discovered command file
protected
static buildCommandRouteEntry(string $command, string $location, string|null &$namespace, bool $isLast) : array<string|int, mixed>|null
Parameters
- $command : string
- $location : string
- $namespace : string|null
- $isLast : bool
Return values
array<string|int, mixed>|nulldetectNamespace()
Detect the namespace declared in a PHP file
protected
static detectNamespace(string $file) : string|null
Parameters
- $file : string