Skip to content

Commit

Permalink
Merge pull request #38 from studoo-app/dev
Browse files Browse the repository at this point in the history
v0.4.2
  • Loading branch information
bfoujols authored Oct 6, 2023
2 parents 5e0d64c + 77e150e commit 707f6e2
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/EduFramework/Core/Controller/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,28 @@ public function __construct(string $route, string $httpMethod)
$this->route = $route;
}

/**
* Permet de récupérer les headers de la requête HTTP
* @return bool|array<mixed>
*/
public function getHearder(): bool|array
{
if (!function_exists('getallheaders')) {
$headers = [];
foreach ($_SERVER as $name => $value) {
if (substr($name, 0, 5) === 'HTTP_') {
$headers[str_replace(
' ',
'-',
ucwords(strtolower(str_replace('_', ' ', substr($name, 5))))
)] = $value;
}
}
return $headers;
}
return getallheaders();
}

/**
* Permet de récupérer une variable de la requête HTTP
* @param string $key Le nom de la variable
Expand Down

0 comments on commit 707f6e2

Please sign in to comment.