Skip to content
Browse files

Removing invalid indentation and trailing whitespace second attempt

  • Loading branch information...
1 parent a8ce3d3 commit bcf21195e996f46ca26f7ac51a9a454dd1df0bd9 Joseph Crawford committed Nov 26, 2012
Showing with 48 additions and 48 deletions.
  1. +48 −48 library/Zend/Http/Header/SetCookie.php
View
96 library/Zend/Http/Header/SetCookie.php
@@ -98,7 +98,7 @@ public static function fromString($headerLine, $bypassHeaderFieldName = false)
$setCookieProcessor = function($headerLine) use ($setCookieClass) {
$header = new $setCookieClass;
$keyValuePairs = preg_split('#;\s*#', $headerLine);
-
+
foreach ($keyValuePairs as $keyValue) {
if (strpos($keyValue, '=')) {
list($headerKey, $headerValue) = preg_split('#=\s*#', $keyValue, 2);
@@ -113,7 +113,7 @@ public static function fromString($headerLine, $bypassHeaderFieldName = false)
$header->setValue(urldecode($headerValue));
continue;
}
-
+
// Process the remaining elements
switch (str_replace(array('-', '_'), '', strtolower($headerKey))) {
case 'expires' : $header->setExpires($headerValue); break;
@@ -514,32 +514,32 @@ public function isValidForRequest($requestDomain, $path, $isSecure = false)
*/
public function match($uri, $matchSessionCookies = true, $now = null)
{
- if (is_string ($uri)) {
- $uri = Zend\Uri\UriFactory::factory($uri);
- }
-
- // Make sure we have a valid Zend_Uri_Http object
- if (! ($uri->isValid() && ($uri->getScheme() == 'http' || $uri->getScheme() =='https'))) {
- throw new Exception\InvalidArgumentException('Passed URI is not a valid HTTP or HTTPS URI');
- }
-
- // Check that the cookie is secure (if required) and not expired
- if ($this->secure && $uri->getScheme() != 'https') return false;
- if ($this->isExpired($now)) return false;
- if ($this->isSessionCookie() && ! $matchSessionCookies) return false;
-
- // Check if the domain matches
- if (! self::matchCookieDomain($this->getDomain(), $uri->getHost())) {
- return false;
- }
-
- // Check that path matches using prefix match
- if (! self::matchCookiePath($this->getPath(), $uri->getPath())) {
- return false;
- }
-
- // If we didn't die until now, return true.
- return true;
+ if (is_string ($uri)) {
+ $uri = Zend\Uri\UriFactory::factory($uri);
+ }
+
+ // Make sure we have a valid Zend_Uri_Http object
+ if (! ($uri->isValid() && ($uri->getScheme() == 'http' || $uri->getScheme() =='https'))) {
+ throw new Exception\InvalidArgumentException('Passed URI is not a valid HTTP or HTTPS URI');
+ }
+
+ // Check that the cookie is secure (if required) and not expired
+ if ($this->secure && $uri->getScheme() != 'https') return false;
+ if ($this->isExpired($now)) return false;
+ if ($this->isSessionCookie() && ! $matchSessionCookies) return false;
+
+ // Check if the domain matches
+ if (! self::matchCookieDomain($this->getDomain(), $uri->getHost())) {
+ return false;
+ }
+
+ // Check that path matches using prefix match
+ if (! self::matchCookiePath($this->getPath(), $uri->getPath())) {
+ return false;
+ }
+
+ // If we didn't die until now, return true.
+ return true;
}
/**
@@ -554,19 +554,19 @@ public function match($uri, $matchSessionCookies = true, $now = null)
*/
public static function matchCookieDomain($cookieDomain, $host)
{
- if (! $cookieDomain) {
- throw new Exception\InvalidArgumentException('$cookieDomain is expected to be a cookie domain');
- }
-
- if (! $host) {
- throw new Exception\InvalidArgumentException('$host is expected to be a host name');
- }
-
- $cookieDomain = strtolower($cookieDomain);
- $host = strtolower($host);
- // Check for either exact match or suffix match
- return ($cookieDomain == $host ||
- preg_match('/' . preg_quote($cookieDomain) . '$/', $host));
+ if (! $cookieDomain) {
+ throw new Exception\InvalidArgumentException('$cookieDomain is expected to be a cookie domain');
+ }
+
+ if (! $host) {
+ throw new Exception\InvalidArgumentException('$host is expected to be a host name');
+ }
+
+ $cookieDomain = strtolower($cookieDomain);
+ $host = strtolower($host);
+ // Check for either exact match or suffix match
+ return ($cookieDomain == $host ||
+ preg_match('/' . preg_quote($cookieDomain) . '$/', $host));
}
/**
@@ -580,15 +580,15 @@ public static function matchCookieDomain($cookieDomain, $host)
*/
public static function matchCookiePath($cookiePath, $path)
{
- if (! $cookiePath) {
- throw new Exception\InvalidArgumentException('$cookiePath is expected to be a cookie path');
- }
+ if (! $cookiePath) {
+ throw new Exception\InvalidArgumentException('$cookiePath is expected to be a cookie path');
+ }
- if (! $path) {
- throw new Exception\InvalidArgumentException('$path is expected to be a host name');
- }
+ if (! $path) {
+ throw new Exception\InvalidArgumentException('$path is expected to be a host name');
+ }
- return (strpos($path, $cookiePath) === 0);
+ return (strpos($path, $cookiePath) === 0);
}
public function toString()

0 comments on commit bcf2119

Please sign in to comment.
Something went wrong with that request. Please try again.