DiscordPHP Documentation

SubCommandRegistry
in package

Registry for managing sub-commands and their aliases.

Table of Contents

Properties

$normalizer  : callable
Callable normalizer for command/alias names.
$subCommandAliases  : array<string, string>
$subCommands  : array<string, Command>

Methods

__construct()  : mixed
all()  : array<string, Command>
Returns all registered sub-commands.
get()  : Command|null
register()  : string
Register a Command instance and its aliases. Returns the normalized key.
registerAlias()  : void
unregister()  : void
unregisterAlias()  : void
normalize()  : string

Properties

$normalizer

Callable normalizer for command/alias names.

protected callable $normalizer

Methods

__construct()

public __construct(callable $normalizer) : mixed
Parameters
$normalizer : callable

get()

public get(string|null $command[, bool $aliases = true ]) : Command|null
Parameters
$command : string|null
$aliases : bool = true
Return values
Command|null

register()

Register a Command instance and its aliases. Returns the normalized key.

public register(Command $commandInstance[, array<string|int, mixed> $aliases = [] ]) : string
Parameters
$commandInstance : Command
$aliases : array<string|int, mixed> = []
Return values
string

registerAlias()

public registerAlias(string $alias, string $command) : void
Parameters
$alias : string
$command : string

unregister()

public unregister(string $command) : void
Parameters
$command : string

unregisterAlias()

public unregisterAlias(string $alias) : void
Parameters
$alias : string

normalize()

protected normalize(string $name) : string
Parameters
$name : string
Return values
string
On this page

Search results