Aerys\Request::getLocalVar PHP Method

getLocalVar() public method

Each request has its own mutable local storage to which application callables and middleware may read and write data. Other callables which are aware of this data can then access it without the server being tightly coupled to specific implementations.
public getLocalVar ( string $key ) : mixed
$key string
return mixed
    public function getLocalVar(string $key);

Usage Example

Exemplo n.º 1
0
 /**
  * Respond to HTTP requests for filesystem resources
  */
 public function __invoke(Request $request, Response $response)
 {
     $uri = $request->getLocalVar("aerys.sendfile") ?: $request->getUri();
     $path = ($qPos = \strpos($uri, "?")) ? \substr($uri, 0, $qPos) : $uri;
     // IMPORTANT! Do NOT remove this. If this is left in, we'll be able to use /path\..\../outsideDocRoot defeating the removeDotPathSegments() function! (on Windows at least)
     $path = \str_replace("\\", "/", $path);
     $path = self::removeDotPathSegments($path);
     // We specifically break the lookup generator out into its own method
     // so that we can potentially avoid forcing the server to resolve a
     // coroutine when the file is already cached.
     return ($fileInfo = $this->fetchCachedStat($path, $request)) ? $this->respond($fileInfo, $request, $response) : $this->respondWithLookup($this->root . $path, $path, $request, $response);
 }
All Usage Examples Of Aerys\Request::getLocalVar