class Command extends Component

命令行任务基类

Properties

ContainerInterface $container from Component
EventManagerInterface $events from Component
DispatcherInterface $dispatcher
RouterInterface $router

Methods

setContainer(ContainerInterface $container)

设置依赖注入容器

from Component
getContainer()

获取依赖注入容器

from Component
listen(string $name, object $listener)

监听某个事件

from Component
bool
trigger(string|EventInterface $event, mixed $data = null)

触发事件

from Component
__get(string $name)

获取容器中的某个服务

from Component
getRunnable()

No description

getName()

No description

getCount()

No description

getDaemonize()

No description

getRefork()

No description

getLogFile()

No description

Details

in Component at line 24
setContainer(ContainerInterface $container)

设置依赖注入容器

Parameters

ContainerInterface $container 容器对象实例

in Component at line 29
ContainerInterface getContainer()

获取依赖注入容器

Return Value

ContainerInterface

in Component at line 43
listen(string $name, object $listener)

监听某个事件

Parameters

string $name 事件名称
object $listener 匿名函数|对象实例

in Component at line 63
bool trigger(string|EventInterface $event, mixed $data = null)

触发事件

$this->trigger(App::ON_BOOT, $data);

$event = new Event(App::ON_FINISH, $data);
$this->trigger($event);

Parameters

string|EventInterface $event 事件名称或事件对象实例
mixed $data 事件相关数据

Return Value

bool 是否执行了当前事件的监听器

in Component at line 74
ContainerInterface|mixed __get(string $name)

获取容器中的某个服务

Parameters

string $name

Return Value

ContainerInterface|mixed

at line 22
getRunnable()

at line 27
getName()

at line 32
getCount()

at line 37
getDaemonize()

at line 42
getRefork()

at line 47
getLogFile()