O:39:"phpDocumentor\Descriptor\FileDescriptor":20:{s:7:" * hash";s:32:"b78d688f7e39f3ca50695e494cb0767f";s:9:" * source";s:2673:"<?php

namespace OpenCloud\Common\Request\Response;

use OpenCloud\Common\Base;

/**
 * The HttpResponse returns an object with status information, separated
 * headers, and any response body necessary.
 *
 * @api
 * @author Glen Campbell <glen.campbell@rackspace.com>
 */
 
class Http extends Base 
{

    private $errno;
    private $error;
    private $info = array();
    private $body;
    private $headers = array();

    /**
     * The constructor parses everything necessary
     */
    public function __construct($request, $data) 
    {
        // save the raw data (who knows? we might need it)
        $this->body = $data;

        // and split each line into name: value pairs
        foreach($request->ReturnHeaders() as $line) {
            if (preg_match('/^([^:]+):\s+(.+?)\s*$/', $line, $matches)) {
                $this->headers[$matches[1]] = $matches[2];
            } else {
                $this->headers[$line] = trim($line);
            }
        }

        // debug caching
        if (isset($this->headers['Cache-Control'])) {
            $this->debug('Cache-Control: %s', $this->headers['Cache-Control']);
        }

        if (isset($this->headers['Expires'])) {
            $this->debug('Expires: %s', $this->headers['Expires']);
        }

        // set some other data
        $this->info = $request->info();
        $this->errno = $request->errno();
        $this->error = $request->error();
    }

    /**
     * Returns the full body of the request
     *
     * @return string
     */
    public function HttpBody() 
    {
        return $this->body;
    }

    /**
     * Returns an array of headers
     *
     * @return associative array('header'=>value)
     */
    public function Headers() 
    {
        return $this->headers;
    }

    /**
     * Returns a single header
     *
     * @return string with the value of the requested header, or NULL
     */
    public function Header($name) 
    {
        return isset($this->headers[$name]) ? $this->headers[$name] : NULL;
    }

    /**
     * Returns an array of information
     *
     * @return array
     */
    public function info() 
    {
        return $this->info;
    }

    /**
     * Returns the most recent error number
     *
     * @return integer
     */
    public function errno()
    {
        return $this->errno;
    }

    /**
     * Returns the most recent error message
     *
     * @return string
     */
    public function error() 
    {
        return $this->error;
    }

    /**
     * Returns the HTTP status code
     *
     * @return integer
     */
    public function HttpStatus() 
    {
        return $this->info['http_code'];
    }

}
";s:20:" * namespace_aliases";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:11:" * includes";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:12:" * constants";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:12:" * functions";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:10:" * classes";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:4:"Http";O:40:"phpDocumentor\Descriptor\ClassDescriptor":17:{s:9:" * parent";s:22:"\OpenCloud\Common\Base";s:13:" * implements";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:11:" * abstract";b:0;s:8:" * final";b:0;s:12:" * constants";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:13:" * properties";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:5:{s:5:"errno";O:43:"phpDocumentor\Descriptor\PropertyDescriptor":15:{s:9:" * parent";r:14;s:8:" * types";N;s:10:" * default";N;s:9:" * static";b:0;s:13:" * visibility";s:7:"private";s:8:" * fqsen";s:46:"\OpenCloud\Common\Request\Response\Http::errno";s:7:" * name";s:5:"errno";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:0:"";s:14:" * description";s:0:"";s:7:" * path";s:0:"";s:7:" * line";i:18;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:8:"internal";N;}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:40:"phpDocumentor\Descriptor\Validator\Error":4:{s:11:" * severity";s:5:"error";s:7:" * code";s:13:"PPC:ERR-50007";s:7:" * line";i:18;s:10:" * context";a:1:{i:0;s:6:"$errno";}}}}}s:5:"error";O:43:"phpDocumentor\Descriptor\PropertyDescriptor":15:{s:9:" * parent";r:14;s:8:" * types";N;s:10:" * default";N;s:9:" * static";b:0;s:13:" * visibility";s:7:"private";s:8:" * fqsen";s:46:"\OpenCloud\Common\Request\Response\Http::error";s:7:" * name";s:5:"error";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:0:"";s:14:" * description";s:0:"";s:7:" * path";s:0:"";s:7:" * line";i:19;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:8:"internal";N;}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:40:"phpDocumentor\Descriptor\Validator\Error":4:{s:11:" * severity";s:5:"error";s:7:" * code";s:13:"PPC:ERR-50007";s:7:" * line";i:19;s:10:" * context";a:1:{i:0;s:6:"$error";}}}}}s:4:"info";O:43:"phpDocumentor\Descriptor\PropertyDescriptor":15:{s:9:" * parent";r:14;s:8:" * types";N;s:10:" * default";s:7:"array()";s:9:" * static";b:0;s:13:" * visibility";s:7:"private";s:8:" * fqsen";s:45:"\OpenCloud\Common\Request\Response\Http::info";s:7:" * name";s:4:"info";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:0:"";s:14:" * description";s:0:"";s:7:" * path";s:0:"";s:7:" * line";i:20;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:8:"internal";N;}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:40:"phpDocumentor\Descriptor\Validator\Error":4:{s:11:" * severity";s:5:"error";s:7:" * code";s:13:"PPC:ERR-50007";s:7:" * line";i:20;s:10:" * context";a:1:{i:0;s:5:"$info";}}}}}s:4:"body";O:43:"phpDocumentor\Descriptor\PropertyDescriptor":15:{s:9:" * parent";r:14;s:8:" * types";N;s:10:" * default";N;s:9:" * static";b:0;s:13:" * visibility";s:7:"private";s:8:" * fqsen";s:45:"\OpenCloud\Common\Request\Response\Http::body";s:7:" * name";s:4:"body";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:0:"";s:14:" * description";s:0:"";s:7:" * path";s:0:"";s:7:" * line";i:21;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:8:"internal";N;}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:40:"phpDocumentor\Descriptor\Validator\Error":4:{s:11:" * severity";s:5:"error";s:7:" * code";s:13:"PPC:ERR-50007";s:7:" * line";i:21;s:10:" * context";a:1:{i:0;s:5:"$body";}}}}}s:7:"headers";O:43:"phpDocumentor\Descriptor\PropertyDescriptor":15:{s:9:" * parent";r:14;s:8:" * types";N;s:10:" * default";s:7:"array()";s:9:" * static";b:0;s:13:" * visibility";s:7:"private";s:8:" * fqsen";s:48:"\OpenCloud\Common\Request\Response\Http::headers";s:7:" * name";s:7:"headers";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:0:"";s:14:" * description";s:0:"";s:7:" * path";s:0:"";s:7:" * line";i:22;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:8:"internal";N;}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:40:"phpDocumentor\Descriptor\Validator\Error":4:{s:11:" * severity";s:5:"error";s:7:" * code";s:13:"PPC:ERR-50007";s:7:" * line";i:22;s:10:" * context";a:1:{i:0;s:8:"$headers";}}}}}}}s:10:" * methods";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:8:{s:11:"__construct";O:41:"phpDocumentor\Descriptor\MethodDescriptor":16:{s:9:" * parent";r:14;s:11:" * abstract";b:0;s:8:" * final";b:0;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:12:" * arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:8:"$request";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":13:{s:8:" * types";a:0:{}s:10:" * default";N;s:14:" * byReference";b:0;s:8:" * fqsen";s:0:"";s:7:" * name";s:8:"$request";s:12:" * namespace";N;s:10:" * package";N;s:10:" * summary";s:0:"";s:14:" * description";s:0:"";s:7:" * path";s:0:"";s:7:" * line";i:0;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}s:5:"$data";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":13:{s:8:" * types";a:0:{}s:10:" * default";N;s:14:" * byReference";b:0;s:8:" * fqsen";s:0:"";s:7:" * name";s:5:"$data";s:12:" * namespace";N;s:10:" * package";N;s:10:" * summary";s:0:"";s:14:" * description";s:0:"";s:7:" * path";s:0:"";s:7:" * line";i:0;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}s:8:" * fqsen";s:54:"\OpenCloud\Common\Request\Response\Http::__construct()";s:7:" * name";s:11:"__construct";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:43:"The constructor parses everything necessary";s:14:" * description";s:0:"";s:7:" * path";s:0:"";s:7:" * line";i:27;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:5:"param";a:0:{}s:8:"internal";N;}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}s:8:"HttpBody";O:41:"phpDocumentor\Descriptor\MethodDescriptor":16:{s:9:" * parent";r:14;s:11:" * abstract";b:0;s:8:" * final";b:0;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:12:" * arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:51:"\OpenCloud\Common\Request\Response\Http::HttpBody()";s:7:" * name";s:8:"HttpBody";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:36:"Returns the full body of the request";s:14:" * description";s:0:"";s:7:" * path";s:0:"";s:7:" * line";i:61;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Tag\ReturnDescriptor":3:{s:8:" * types";a:1:{i:0;s:6:"string";}s:7:" * name";s:6:"return";s:14:" * description";s:0:"";}}}s:8:"internal";N;}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}s:7:"Headers";O:41:"phpDocumentor\Descriptor\MethodDescriptor":16:{s:9:" * parent";r:14;s:11:" * abstract";b:0;s:8:" * final";b:0;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:12:" * arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:50:"\OpenCloud\Common\Request\Response\Http::Headers()";s:7:" * name";s:7:"Headers";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:27:"Returns an array of headers";s:14:" * description";s:0:"";s:7:" * path";s:0:"";s:7:" * line";i:71;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Tag\ReturnDescriptor":3:{s:8:" * types";a:1:{i:0;s:46:"\OpenCloud\Common\Request\Response\associative";}s:7:" * name";s:6:"return";s:14:" * description";s:22:"array('header'=>value)";}}}s:8:"internal";N;}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}s:6:"Header";O:41:"phpDocumentor\Descriptor\MethodDescriptor":16:{s:9:" * parent";r:14;s:11:" * abstract";b:0;s:8:" * final";b:0;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:12:" * arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:5:"$name";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":13:{s:8:" * types";a:0:{}s:10:" * default";N;s:14:" * byReference";b:0;s:8:" * fqsen";s:0:"";s:7:" * name";s:5:"$name";s:12:" * namespace";N;s:10:" * package";N;s:10:" * summary";s:0:"";s:14:" * description";s:0:"";s:7:" * path";s:0:"";s:7:" * line";i:0;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}s:8:" * fqsen";s:49:"\OpenCloud\Common\Request\Response\Http::Header()";s:7:" * name";s:6:"Header";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:23:"Returns a single header";s:14:" * description";s:0:"";s:7:" * path";s:0:"";s:7:" * line";i:81;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:3:{s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Tag\ReturnDescriptor":3:{s:8:" * types";a:1:{i:0;s:6:"string";}s:7:" * name";s:6:"return";s:14:" * description";s:47:"with the value of the requested header, or NULL";}}}s:5:"param";a:0:{}s:8:"internal";N;}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}s:4:"info";O:41:"phpDocumentor\Descriptor\MethodDescriptor":16:{s:9:" * parent";r:14;s:11:" * abstract";b:0;s:8:" * final";b:0;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:12:" * arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:47:"\OpenCloud\Common\Request\Response\Http::info()";s:7:" * name";s:4:"info";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:31:"Returns an array of information";s:14:" * description";s:0:"";s:7:" * path";s:0:"";s:7:" * line";i:91;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Tag\ReturnDescriptor":3:{s:8:" * types";a:1:{i:0;s:5:"array";}s:7:" * name";s:6:"return";s:14:" * description";s:0:"";}}}s:8:"internal";N;}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}s:5:"errno";O:41:"phpDocumentor\Descriptor\MethodDescriptor":16:{s:9:" * parent";r:14;s:11:" * abstract";b:0;s:8:" * final";b:0;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:12:" * arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:48:"\OpenCloud\Common\Request\Response\Http::errno()";s:7:" * name";s:5:"errno";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:36:"Returns the most recent error number";s:14:" * description";s:0:"";s:7:" * path";s:0:"";s:7:" * line";i:101;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Tag\ReturnDescriptor":3:{s:8:" * types";a:1:{i:0;s:7:"integer";}s:7:" * name";s:6:"return";s:14:" * description";s:0:"";}}}s:8:"internal";N;}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}s:5:"error";O:41:"phpDocumentor\Descriptor\MethodDescriptor":16:{s:9:" * parent";r:14;s:11:" * abstract";b:0;s:8:" * final";b:0;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:12:" * arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:48:"\OpenCloud\Common\Request\Response\Http::error()";s:7:" * name";s:5:"error";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:37:"Returns the most recent error message";s:14:" * description";s:0:"";s:7:" * path";s:0:"";s:7:" * line";i:111;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Tag\ReturnDescriptor":3:{s:8:" * types";a:1:{i:0;s:6:"string";}s:7:" * name";s:6:"return";s:14:" * description";s:0:"";}}}s:8:"internal";N;}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}s:10:"HttpStatus";O:41:"phpDocumentor\Descriptor\MethodDescriptor":16:{s:9:" * parent";r:14;s:11:" * abstract";b:0;s:8:" * final";b:0;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:12:" * arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:53:"\OpenCloud\Common\Request\Response\Http::HttpStatus()";s:7:" * name";s:10:"HttpStatus";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:28:"Returns the HTTP status code";s:14:" * description";s:0:"";s:7:" * path";s:0:"";s:7:" * line";i:121;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Tag\ReturnDescriptor":3:{s:8:" * types";a:1:{i:0;s:7:"integer";}s:7:" * name";s:6:"return";s:14:" * description";s:0:"";}}}s:8:"internal";N;}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}s:8:" * fqsen";s:39:"\OpenCloud\Common\Request\Response\Http";s:7:" * name";s:4:"Http";s:12:" * namespace";s:34:"\OpenCloud\Common\Request\Response";s:10:" * package";s:0:"";s:10:" * summary";s:111:"The HttpResponse returns an object with status information, separated
headers, and any response body necessary.";s:14:" * description";s:0:"";s:7:" * path";r:1;s:7:" * line";i:15;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:3:"api";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:38:"phpDocumentor\Descriptor\TagDescriptor":2:{s:7:" * name";s:3:"api";s:14:" * description";s:0:"";}}}s:6:"author";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Tag\AuthorDescriptor":2:{s:7:" * name";s:6:"author";s:14:" * description";s:43:"Glen Campbell <glen.campbell@rackspace.com>";}}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}s:13:" * interfaces";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:9:" * traits";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:10:" * markers";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:0:"";s:7:" * name";s:8:"Http.php";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:0:"";s:14:" * description";s:0:"";s:7:" * path";s:42:"OpenCloud/Common/Request/Response/Http.php";s:7:" * line";i:0;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}