本文整理汇总了PHP中Server::attach方法的典型用法代码示例。如果您正苦于以下问题:PHP Server::attach方法的具体用法?PHP Server::attach怎么用?PHP Server::attach使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server
的用法示例。
在下文中一共展示了Server::attach方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: boot
public function boot(Server $server, Logger $logger)
{
$server->attach($this);
$this->bootLoader = function (Bootable $bootable) use($server, $logger) {
return $bootable->boot($server, $logger);
};
return [$this, "__invoke"];
}
示例2: boot
public function boot(Server $server, Logger $logger)
{
$server->attach($this);
}
示例3: boot
public function boot(Server $server, Logger $logger)
{
$server->attach($this);
$this->bootLoader = function (Bootable $bootable) use($server, $logger) {
$booted = $bootable->boot($server, $logger);
if ($booted !== null && !$booted instanceof Middleware && !is_callable($booted)) {
throw new \InvalidArgumentException("Any return value of " . get_class($bootable) . '::boot() must return an instance of Aerys\\Middleware and/or be callable');
}
return $booted ?? $bootable;
};
}
示例4: boot
public function boot(Server $server, Logger $logger)
{
$server->attach($this);
return [$this, "__invoke"];
}