source: branches/camp/camp-2_5-E/data/class/SC_Response.php @ 19119

Revision 19119, 2.8 KB checked in by miningbrownie, 12 years ago (diff)
Line 
1<?php
2class SC_Response{
3
4    /**
5     *
6     * @var HTTP_Response
7     */
8    var $http;
9    /**
10     * コンテンツタイプ
11     * Enter description here ...
12     * @var unknown_type
13     */
14    var $contentType;
15    var $header;
16    var $body;
17    var $statuscode;
18    var $header = array();
19
20    var $statusTexts = array(
21    '100' => 'Continue',
22    '101' => 'Switching Protocols',
23    '200' => 'OK',
24    '201' => 'Created',
25    '202' => 'Accepted',
26    '203' => 'Non-Authoritative Information',
27    '204' => 'No Content',
28    '205' => 'Reset Content',
29    '206' => 'Partial Content',
30    '300' => 'Multiple Choices',
31    '301' => 'Moved Permanently',
32    '302' => 'Found',
33    '303' => 'See Other',
34    '304' => 'Not Modified',
35    '305' => 'Use Proxy',
36    '306' => '(Unused)',
37    '307' => 'Temporary Redirect',
38    '400' => 'Bad Request',
39    '401' => 'Unauthorized',
40    '402' => 'Payment Required',
41    '403' => 'Forbidden',
42    '404' => 'Not Found',
43    '405' => 'Method Not Allowed',
44    '406' => 'Not Acceptable',
45    '407' => 'Proxy Authentication Required',
46    '408' => 'Request Timeout',
47    '409' => 'Conflict',
48    '410' => 'Gone',
49    '411' => 'Length Required',
50    '412' => 'Precondition Failed',
51    '413' => 'Request Entity Too Large',
52    '414' => 'Request-URI Too Long',
53    '415' => 'Unsupported Media Type',
54    '416' => 'Requested Range Not Satisfiable',
55    '417' => 'Expectation Failed',
56    '500' => 'Internal Server Error',
57    '501' => 'Not Implemented',
58    '502' => 'Bad Gateway',
59    '503' => 'Service Unavailable',
60    '504' => 'Gateway Timeout',
61    '505' => 'HTTP Version Not Supported',
62    );
63
64
65    /**
66     *
67     * Enter description here ...
68     */
69    var $encoding;
70
71    function SC_Response(){
72        $this->http = new HTTP_Response();
73    }
74
75    function response(){
76        $this->sendHeader();
77       
78    }
79
80    function sendHeader(){
81        // HTTPのヘッダ
82        header('HTTP/1.1 '.$this->statuscode.' '.$this->statusTexts[$this->statuscode]);
83        foreach ($this->header as $name => $head){
84            header($name.': '.$head);
85        }
86
87    }
88
89
90    function setContentLength(int $length){
91
92    }
93
94
95    function setContentType(String $contentType){
96        $this->header['Content-Type'] = $contentType;
97    }
98
99    function setResponseCode(int $code){
100
101    }
102
103    function setResposeBody(String $body){
104
105    }
106
107    function addDateHdeader(String $name, $date){
108
109    }
110    function addHeader(String $name, $value){
111        $this->header[$name] = $value;
112    }
113
114    function containsHeader(String $name){
115        return isset($this->header[$name]);
116    }
117
118    function sendError(int $errorcode){
119
120    }
121
122    function sendRedirect(String $location){
123
124    }
125
126    function setHeader(Array $headers){
127        $this->header = $headers;
128    }
129
130    function setStatus(int $sc = 202){
131        $this->statuscode = $sc;
132    }
133
134}
Note: See TracBrowser for help on using the repository browser.