getOption() public method

Retrieve a server option value
public getOption ( string $option )
$option string The option to retrieve
Esempio n. 1
0
 /**
  * Receive notifications from the server when it starts/stops
  *
  * @param Server $server
  * @return \Amp\Promise
  */
 public function update(Server $server) : amp\Promise
 {
     switch ($server->state()) {
         case Server::STARTING:
             $this->loadMimeFileTypes(__DIR__ . "/../etc/mime");
             break;
         case Server::STARTED:
             $this->debug = $server->getOption("debug");
             amp\enable($this->cacheWatcher);
             break;
         case Server::STOPPED:
             amp\disable($this->cacheWatcher);
             $this->cache = [];
             $this->cacheTimeouts = [];
             $this->cacheEntryCount = 0;
             $this->bufferedFileCount = 0;
             break;
     }
     return new amp\Success();
 }
Esempio n. 2
0
 private function buildRouter(RouteCollector $rc, Server $server)
 {
     $allowedMethods = [];
     foreach ($this->routes as list($method, $uri, $actions)) {
         $allowedMethods[] = $method;
         list($app, $monitors) = $this->bootRouteTarget($actions);
         $rc->addRoute($method, $uri, $app);
         $this->monitors[$method][$uri] = $monitors;
     }
     $originalMethods = $server->getOption("allowedMethods");
     if ($server->getOption("normalizeMethodCase")) {
         $allowedMethods = array_map("strtoupper", $allowedMethods);
     }
     $allowedMethods = array_merge($allowedMethods, $originalMethods);
     $allowedMethods = array_unique($allowedMethods);
     $server->setOption("allowedMethods", $allowedMethods);
 }