Aerys\Server::setOption PHP Method

setOption() public method

Assign a server option value
public setOption ( string $option, mixed $newValue ) : void
$option string The option to retrieve
$newValue mixed
return void
    public function setOption(string $option, $newValue)
    {
        \assert($this->state < self::STARTED);
        $this->options->{$option} = $newValue;
    }

Usage Example

Example #1
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);
 }