attach() public method

Attach an observer
public attach ( aerys\ServerObserver $observer ) : void
$observer aerys\ServerObserver
return void
Esempio n. 1
0
 public function boot(Server $server, Logger $logger)
 {
     $this->logger = $logger;
     if ($this->showActionWarning) {
         $logger->warning("No actions registered for \$host yet, be sure to add them before injecting Host to AcmeHost for best performance.");
     }
     $server->attach(new StartEvent($this->onBoot));
 }
Esempio n. 2
0
 public function boot(Server $server, PsrLogger $logger)
 {
     $server->attach($this);
     $this->bootLoader = static 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;
     };
 }
Esempio n. 3
0
 public function boot(Server $server, PsrLogger $logger)
 {
     $server->attach($this);
 }