class App extends Component

应用

Constants

VERSION

ON_BOOT

ON_FINISH

ON_TERMINATE

Properties

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

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

应用初始化

handle($argv = null)

应用程序启动方法

terminate()

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 33
__construct()

应用初始化

at line 58
handle($argv = null)

应用程序启动方法

Parameters

$argv

at line 89
terminate()