Documentation

CommandRegistry
in package

Console command registry class

Tags
category

Pop

author

Nick Sagona, III nick@popphp.org

copyright

Copyright (c) 2009-2026 Nick Sagona, III

license

https://www.popphp.org/license New BSD License

version
5.0.0

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

addAll()

Add commands

public addAll(array<string|int, mixed> $commands) : static
Parameters
$commands : array<string|int, mixed>
Return values
static

addFromRoutes()

Add commands from routes

public addFromRoutes(Cli $routeMatch[, string|null $scriptName = null ]) : static
Parameters
$routeMatch : Cli
$scriptName : string|null = null
Return values
static

all()

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>

has()

Check if the registry has a command

public has(string $name) : bool
Parameters
$name : string
Return values
bool

loadRoutes()

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>|null

detectNamespace()

Detect the namespace declared in a PHP file

protected static detectNamespace(string $file) : string|null
Parameters
$file : string
Return values
string|null

        
On this page

Search results