X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/membres/message.php?a=blobdiff_plain;f=includes%2FCookie.php;h=8b5906a820a3cc144c63a52de79d9228bdb8ab69;hb=f0edb3e368a5fc69218d20f76f1538b68f37db42;hp=d4c342ba481d0ba3b975c525605ee29163e10b2b;hpb=bfc9be60b7b24ffb7c13a95f94600e8bf3200c67;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Cookie.php b/includes/Cookie.php index d4c342ba48..8b5906a820 100644 --- a/includes/Cookie.php +++ b/includes/Cookie.php @@ -43,8 +43,8 @@ class Cookie { * cookies. Used internally after a request to parse the * Set-Cookie headers. * - * @param string $value the value of the cookie - * @param array $attr possible key/values: + * @param string $value The value of the cookie + * @param array $attr Possible key/values: * expires A date string * path The path this cookie is used on * domain Domain this cookie is used on @@ -85,9 +85,9 @@ class Cookie { * @todo fixme fails to detect 2-letter top-level domains for single-domain use (probably * not a big problem in practice, but there are test cases) * - * @param string $domain the domain to validate + * @param string $domain The domain to validate * @param string $originDomain (optional) the domain the cookie originates from - * @return Boolean + * @return bool */ public static function validateCookieDomain( $domain, $originDomain = null ) { $dc = explode( ".", $domain ); @@ -133,8 +133,14 @@ class Cookie { } if ( substr( $domain, 0, 1 ) == '.' - && substr_compare( $originDomain, $domain, -strlen( $domain ), - strlen( $domain ), true ) != 0 ) { + && substr_compare( + $originDomain, + $domain, + -strlen( $domain ), + strlen( $domain ), + true + ) != 0 + ) { return false; } } @@ -145,9 +151,9 @@ class Cookie { /** * Serialize the cookie jar into a format useful for HTTP Request headers. * - * @param string $path the path that will be used. Required. - * @param string $domain the domain that will be used. Required. - * @return String + * @param string $path The path that will be used. Required. + * @param string $domain The domain that will be used. Required. + * @return string */ public function serializeToHttpRequest( $path, $domain ) { $ret = ''; @@ -162,15 +168,22 @@ class Cookie { } /** - * @param $domain + * @param string $domain * @return bool */ protected function canServeDomain( $domain ) { if ( $domain == $this->domain || ( strlen( $domain ) > strlen( $this->domain ) && substr( $this->domain, 0, 1 ) == '.' - && substr_compare( $domain, $this->domain, -strlen( $this->domain ), - strlen( $this->domain ), true ) == 0 ) ) { + && substr_compare( + $domain, + $this->domain, + -strlen( $this->domain ), + strlen( $this->domain ), + true + ) == 0 + ) + ) { return true; } @@ -178,7 +191,7 @@ class Cookie { } /** - * @param $path + * @param string $path * @return bool */ protected function canServePath( $path ) { @@ -199,6 +212,9 @@ class CookieJar { /** * Set a cookie in the cookie jar. Make sure only one cookie per-name exists. * @see Cookie::set() + * @param string $name + * @param string $value + * @param array $attr */ public function setCookie( $name, $value, $attr ) { /* cookies: case insensitive, so this should work. @@ -215,6 +231,8 @@ class CookieJar { /** * @see Cookie::serializeToHttpRequest + * @param string $path + * @param string $domain * @return string */ public function serializeToHttpRequest( $path, $domain ) { @@ -234,8 +252,8 @@ class CookieJar { /** * Parse the content of an Set-Cookie HTTP Response header. * - * @param $cookie String - * @param string $domain cookie's domain + * @param string $cookie + * @param string $domain Cookie's domain * @return null */ public function parseCookieResponseHeader( $cookie, $domain ) {