class Dispatcher extends Component implements DispatcherInterface

调度器

Constants

ON_BEFORE_DISPATCH_LOOP

ON_AFTER_DISPATCH_LOOP

ON_BEFORE_DISPATCH

ON_AFTER_DISPATCH

Properties

ContainerInterface $container from Component
EventManagerInterface $events from Component

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
dispatch()

执行调度

forward(array $forward)

无需 redirect 跳转,而直接调用对应的 Handler->Action

setNamespaceName(string $namespaceName)

No description

string
getNamespaceName()

No description

setHandlerName(string $handlerName)

No description

string
getHandlerName()

No description

setActionName(string $actionName)

No description

string
getActionName()

No description

setParams(array $params)

No description

array
getParams()

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 36
dispatch()

执行调度

at line 103
forward(array $forward)

无需 redirect 跳转,而直接调用对应的 Handler->Action

Parameters

array $forward { @var string namespace @var string handler @var string action @var array params }

at line 124
setNamespaceName(string $namespaceName)

Parameters

string $namespaceName

at line 129
string getNamespaceName()

Return Value

string

at line 134
setHandlerName(string $handlerName)

Parameters

string $handlerName

at line 139
string getHandlerName()

Return Value

string

at line 144
setActionName(string $actionName)

Parameters

string $actionName

at line 149
string getActionName()

Return Value

string

at line 154
setParams(array $params)

Parameters

array $params

at line 159
array getParams()

Return Value

array