From 92ba3bb1c30cf7356006be1797965f70615ad4e4 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Fri, 6 Dec 2019 14:18:31 +0000 Subject: [PATCH] http : presentation of code git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5801 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- http.php | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/http.php b/http.php index fc8e255..dea7f3e 100644 --- a/http.php +++ b/http.php @@ -1,24 +1,28 @@ */ + * @package domframework + * @author Dominique Fournier + */ /** HTTP Helper : understand the best choices provided by browser, the HTTP - codes */ + * codes + */ class http { /** Choose the best choice from user choices. - Can be used for languages (HTTP_ACCEPT_LANGUAGE), type of pages - (HTTP_ACCEPT)... - Ex. fr, en-gb;q=0.8, en;q=0.7 - Ex. text/html,application/xhtml+xml,application/xml;q=0.9,* /*;q=0.8 - If available is empty, then return the best priority defined by user, - and throw an exception if nothing is provided for by the user. - If nothing match, return $default - @param string $uservar The parameter provided by the user - @param array|null $available The list of available choices in the soft - @param string|null $default The choice if nothing match */ + * Can be used for languages (HTTP_ACCEPT_LANGUAGE), type of pages + * (HTTP_ACCEPT)... + * Ex. fr, en-gb;q=0.8, en;q=0.7 + * Ex. text/html,application/xhtml+xml,application/xml;q=0.9,* /*;q=0.8 + * If available is empty, then return the best priority defined by user, + * and throw an exception if nothing is provided for by the user. + * If nothing match, return $default + * @param string $uservar The parameter provided by the user + * @param array|null $available The list of available choices in the soft + * @param string|null $default The choice if nothing match + */ function bestChoice ($uservar, $available=array(), $default=FALSE) + // {{{ { $uservar = str_replace (" ", "", $uservar); $userchoices = explode (",", $uservar); @@ -60,10 +64,13 @@ class http // No best solution found. Use the default available solution return $default; } + // }}} /** Return the associated text for a HTTP code - @param integer $code The HTTP code to translate in text */ + * @param integer $code The HTTP code to translate in text + */ function codetext ($code) + // {{{ { switch ($code) { @@ -108,7 +115,7 @@ class http default: exit('Unknown http status code "'.htmlentities ($code).'"'); } - return $text; } + // }}} }