Command class

package Default

 Methods

Handling Shutdown

handleShutdown() : void

If you need to customize the handling of shutdown, please override it with subclasses.

codeCoverageIgnore

Main Processing

main(string $command, \Kore\array<string> $args, \Kore\array<string> $opts) : void

Parameters

$command

string

command namespace

$args

\Kore\array<string>

command arguments

$opts

\Kore\array<string>

command options

Get the command name

commandName() : string

The default is the end of the command namespace. If you need to customize, please override it with subclasses.

Returns

stringcommand name

Processing Execution

exec() : void

The process is implemented in subclasses.

Get the command arguments

getArg(string|null $key = null, mixed $default = null) : mixed

If no key is specified, all command arguments are returned.

Parameters

$key

stringnull

command argument key

$default

mixed

default value if there is no value specified in the key

Returns

mixedcommand arguments

Get from array

getFromArray(\Kore\array<mixed> $array, string|null $key = null, mixed $default = null) : mixed

If no key is specified, array is returned.

Parameters

$array

\Kore\array<mixed>

array

$key

stringnull

path key

$default

mixed

default value if there is no value specified in the key

Returns

mixedvalue

Get the command options

getOpt(string|null $key = null, mixed $default = null) : mixed

If no key is specified, all command options are returned.

Parameters

$key

stringnull

command option key

$default

mixed

default value if there is no value specified in the key

Returns

mixedcommand options

Handling Errors

handleError(\Exception $e) : void

If you need to customize the handling of errors, please override it with subclasses.

Parameters

$e

\Exception

errors

Exceptions

\Exception

Get the lock time

lockTime() : integer

The default is 24 hours. If you need to customize, please override it with subclasses.

Returns

integerlock time

Get the log level

logLevel() : integer

The default is Log::LEVEL_DEBUG. If you need to customize, please override it with subclasses.

see \Kore\Log

Returns

integerlog level

 Properties

 

command arguments

$args : \Kore\array<string>

Default

array()
 

command namespace

$command : string

Default

 

LockManager

$lockManager : \Kore\LockManager

Default

 

command options

$opts : \Kore\array<string>

Default

array()