getHeaderArray() public method

All header $field names are treated case-insensitively. An empty return array indicates that the header was not present in the request.
public getHeaderArray ( string $field ) : array
$field string
return array
Example #1
0
 private function fetchCachedStat(string $reqPath, Request $request)
 {
     // We specifically allow users to bypass cached representations in debug mode by
     // using their browser's "force refresh" functionality. This lets us avoid the
     // annoyance of stale file representations being served for a few seconds after
     // changes have been written to disk.
     if (empty($this->debug)) {
         return $this->cache[$reqPath] ?? null;
     }
     foreach ($request->getHeaderArray("Cache-Control") as $value) {
         if (strcasecmp($value, "no-cache") === 0) {
             return null;
         }
     }
     foreach ($request->getHeaderArray("Pragma") as $value) {
         if (strcasecmp($value, "no-cache") === 0) {
             return null;
         }
     }
     return $this->cache[$reqPath] ?? null;
 }