1 | <?php |
||
14 | class Response extends AbstractObject |
||
15 | { |
||
16 | |||
17 | const OK = 200; |
||
18 | const CREATED = 201; |
||
19 | const ACCEPTED = 202; |
||
20 | const NON_AUTHORITATIVE_INFORMATION = 203; |
||
21 | const NO_CONTENT = 204; |
||
22 | const RESET_CONTENT = 205; |
||
23 | const PARTIAL_CONTENT = 206; |
||
24 | const BAD_REQUEST = 400; |
||
25 | const UNAUTHORIZED = 401; |
||
26 | const PAYMENT_REQUIRED = 402; |
||
27 | const FORBIDDEN = 403; |
||
28 | const NOT_FOUND = 404; |
||
29 | const METHOD_NOT_ALLOWED = 405; |
||
30 | const NOT_ACCEPTABLE = 406; |
||
31 | const PROXY_AUTHENTICATION_REQUIRED = 407; |
||
32 | const REQUEST_TIMEOUT = 408; |
||
33 | const CONFLICT = 409; |
||
34 | const GONE = 410; |
||
35 | const LENGTH_REQUIRED = 411; |
||
36 | const PRECONDITION_FAILED = 412; |
||
37 | const REQUEST_ENTITY_TOO_LARGE = 413; |
||
38 | const REQUEST_URI_TOO_LONG = 414; |
||
39 | const UNSUPPORTED_MEDIA_TYPE = 415; |
||
40 | const REQUESTED_RANGE_NOT_SATISFIABLE = 416; |
||
41 | const EXPECTATION_FAILED = 417; |
||
42 | const UNPROCESSABLE_ENTITY = 422; |
||
43 | const TOO_MANY_REQUESTS = 429; |
||
44 | const INTERNAL_SERVER_ERROR = 500; |
||
45 | const NOT_IMPLEMENTED = 501; // When method is supported for none of the resources |
||
46 | |||
47 | protected static $httpCodes = array( |
||
48 | self::OK => "OK", |
||
49 | self::CREATED => "Created", |
||
50 | self::ACCEPTED => "Accepted", |
||
51 | self::NON_AUTHORITATIVE_INFORMATION => "Non-Authoritative Information", |
||
52 | self::NO_CONTENT => "No Content", |
||
53 | self::RESET_CONTENT => "Reset Content", |
||
54 | self::PARTIAL_CONTENT => "Partial Content", |
||
55 | self::BAD_REQUEST => "Bad Request", |
||
56 | self::UNAUTHORIZED => "Unauthorized", |
||
57 | self::PAYMENT_REQUIRED => "Payment Required", |
||
58 | self::FORBIDDEN => "Forbidden", |
||
59 | self::NOT_FOUND => "Not Found", |
||
60 | self::METHOD_NOT_ALLOWED => "Method Not Allowed", |
||
61 | self::NOT_ACCEPTABLE => "Not Acceptable", |
||
62 | self::PROXY_AUTHENTICATION_REQUIRED => "Proxy Authentication Required", |
||
63 | self::REQUEST_TIMEOUT => "Request Timeout", |
||
64 | self::CONFLICT => "Conflict", |
||
65 | self::GONE => "Gone", |
||
66 | self::LENGTH_REQUIRED => 'Length Required', |
||
67 | self::PRECONDITION_FAILED => 'Precondition Failed', |
||
68 | self::REQUEST_ENTITY_TOO_LARGE => 'Request Entity Too Large', |
||
69 | self::REQUEST_URI_TOO_LONG => 'Request-URI Too Long', |
||
70 | self::UNSUPPORTED_MEDIA_TYPE => "Unsupported Media Type", |
||
71 | self::REQUESTED_RANGE_NOT_SATISFIABLE => 'Requested Range Not Satisfiable', |
||
72 | self::EXPECTATION_FAILED => 'Expectation Failed', |
||
73 | self::UNPROCESSABLE_ENTITY => "Unprocessable Entity", |
||
74 | self::TOO_MANY_REQUESTS => "Too Many Requests", |
||
75 | self::INTERNAL_SERVER_ERROR => "Internal Server Error", |
||
76 | self::NOT_IMPLEMENTED => "Not Implemented", |
||
77 | ); |
||
78 | private $description = ''; |
||
79 | private $schema; |
||
80 | |||
81 | /** |
||
82 | * @var Header[] |
||
83 | */ |
||
84 | private $Headers = array(); |
||
85 | |||
86 | /** |
||
87 | * JSON examples |
||
88 | * @var array |
||
89 | */ |
||
90 | private $examples = array(); |
||
91 | |||
92 | public static function getCode($search) |
||
111 | |||
112 | public function __construct(AbstractObject $parent, $code, $definition = null, $description = null) |
||
126 | |||
127 | /** |
||
128 | * @param string $command |
||
129 | * @param string $data |
||
130 | * @return \SwaggerGen\Swagger\AbstractObject|boolean |
||
131 | */ |
||
132 | public function handleCommand($command, $data = null) |
||
166 | |||
167 | public function toArray() |
||
176 | |||
177 | public function __toString() |
||
181 | |||
182 | } |
||
183 |