code: protected function parseCookie($cookie_line)
      {
          $parts  = explode(';', $cookie_line);
          $cookie = array();
          preg_match('/\s*(.*?)\s*=(.*)/', array_shift($parts), $cookie);
          foreach ($parts as $part) {
              if (preg_match('/\s*(.*?)\s*=(.*)/', $part, $matches)) {
                  $cookie[$matches[1]] = trim($matches[2]);
              }
          }
  
          return new SimpleCookie(
                  $cookie[1],
                  trim($cookie[2]),
                  isset($cookie['path']) ? $cookie['path'] : '',
                  isset($cookie['expires']) ? $cookie['expires'] : false);
      }
docs: Parse the Set-cookie content.
  
  @param string $cookie_line    Text after "Set-cookie:"
  
  @return SimpleCookie          New cookie object.