23 lines
574 B
PHP
23 lines
574 B
PHP
|
<?php
|
||
|
namespace nur;
|
||
|
|
||
|
use nur\b\values\Mparams;
|
||
|
|
||
|
/**
|
||
|
* Class R: gestion des paramètres $_REQUEST (GET + POST + COOKIES)
|
||
|
*/
|
||
|
class R extends Mparams {
|
||
|
/** tester si le paramètre $name existe */
|
||
|
static final function has($name): bool {
|
||
|
if ($name === null || $name === false) return false;
|
||
|
return array_key_exists($name, $_REQUEST);
|
||
|
}
|
||
|
|
||
|
/** obtenir le paramètre $name */
|
||
|
static final function get($name, $default=null, bool $trim=false) {
|
||
|
$value = A::get($_REQUEST, $name, $default);
|
||
|
if ($trim) $value = str::trim($value);
|
||
|
return $value;
|
||
|
}
|
||
|
}
|