| Server IP : 54.36.91.62 / Your IP : 216.73.217.94 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/coopiak/amisdesseniors-fr/annonces/templates/yootheme/packages/http-message/src/ |
Upload File : |
<?php
namespace YOOtheme\Http;
use Psr\Http\Message\UploadedFileInterface;
use YOOtheme\Http\Message\ServerRequest;
class Request extends ServerRequest
{
use MessageTrait;
/**
* Gets a parameter (shortcut).
*
* @param string $key
* @param mixed $default
*
* @return mixed
*/
public function __invoke($key, $default = null)
{
return $this->getParam($key, $default);
}
/**
* Retrieve a parameter value from body or query string (in that order).
*
* @param string $key
* @param mixed $default
*
* @return mixed
*/
public function getParam($key, $default = null)
{
$body = $this->getParsedBody();
if (is_array($body) && array_key_exists($key, $body)) {
return $body[$key];
}
if (is_object($body) && property_exists($body, $key)) {
return $body->$key;
}
return $this->getQueryParam($key, $default);
}
/**
* Retrieve a value from query string parameters.
*
* @param string $key
* @param mixed $default
*
* @return mixed
*/
public function getQueryParam($key, $default = null)
{
$query = $this->getQueryParams();
return $query[$key] ?? $default;
}
/**
* Retrieve a value from cookies.
*
* @param string $key
* @param mixed $default
*
* @return mixed
*/
public function getCookieParam($key, $default = null)
{
$cookies = $this->getCookieParams();
return $cookies[$key] ?? $default;
}
/**
* Retrieve a value from server parameters.
*
* @param string $key
* @param mixed $default
*
* @return mixed
*/
public function getServerParam($key, $default = null)
{
$server = $this->getServerParams();
return $server[$key] ?? $default;
}
/**
* Retrieve a single file upload.
*
* @param string $key
*
* @return UploadedFileInterface|null
*/
public function getUploadedFile($key)
{
$files = $this->getUploadedFiles();
return $files[$key] ?? null;
}
/**
* Does this request use a given method?
*
* @param string $method
*
* @return bool
*/
public function isMethod($method)
{
return $this->getMethod() === strtoupper($method);
}
/**
* Throws an exception.
*
* @param int $code
* @param string $message
*
* @throws Exception
*/
public function abort($code, $message = '')
{
throw new Exception($code, $message);
}
/**
* Throws an exception if given condition is true.
*
* @param bool $bool
* @param int $code
* @param string $message
*
* @throws Exception
*
* @return $this
*/
public function abortIf($bool, $code, $message = '')
{
if ($bool) {
throw new Exception($code, $message);
}
return $this;
}
}