Overview

Namespaces

  • Mapbender
    • Component
      • HTTP
    • CoreBundle
      • Command
      • Component
        • Exception
      • Controller
      • DataFixtures
        • ORM
      • DependencyInjection
      • Element
        • Type
      • Entity
      • EventListener
      • Extension
      • Form
        • DataTransformer
        • EventListener
        • Type
      • Security
      • Template
    • DrupalIntegrationBundle
      • DependencyInjection
      • Security
        • Authentication
          • Provider
          • Token
        • Authorization
          • Voter
        • Factory
        • Firewall
        • User
      • Session
    • KmlBundle
      • Element
    • ManagerBundle
      • Controller
      • Form
        • DataTransformer
        • Type
    • MonitoringBundle
      • Command
      • Component
      • Controller
      • DependencyInjection
      • Entity
      • EventListener
      • Form
    • PrintBundle
      • Component
      • Controller
    • WmcBundle
      • Component
        • Exception
      • Element
        • Type
      • Entity
      • Form
        • EventListener
        • Type
    • WmsBundle
      • Component
        • Exception
      • Controller
      • DependencyInjection
      • Element
        • Type
      • Entity
      • Event
      • Form
        • EventListener
        • Type
    • WmtsBundle
      • Component
        • Exception
      • Controller
      • Entity
      • Form
        • Type
  • None
  • PHP

Classes

  • HTTPClient
  • HTTPResult
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
  • Download
 1: <?php
 2: 
 3: namespace Mapbender\Component\HTTP;
 4: 
 5: class HTTPResult {
 6: 
 7: 
 8: 
 9:     protected $statusCode = "";
10:     protected $data = null;
11:     protected $headers = array();
12: 
13:     
14:     public function isSuccess(){
15:         // FIXME: this is very crude
16:         return  ($this->statusCode < 400);
17:     }
18:     
19:     public function setHeaders($headers){
20:         $this->headers = $headers;
21:     }
22: 
23:     public function getHeaders(){
24:         return $this->headers;
25:     }
26:     
27:     public function getHeader($header){
28:         if(isset($this->headers) && isset($this->headers[$header])){
29:             return $this->headers[$header];
30:         } else {
31:             return null;
32:         }
33:     }
34: 
35:     public function setData($data){
36:         $this->data = $data;
37:     }
38: 
39:     public function getData(){
40:         return $this->data;
41:     }
42:     
43:     public function setStatusCode($statusCode){
44:         $this->statusCode = $statusCode;
45:     }
46: 
47:     public function getStatusCode(){
48:         return $this->statusCode;
49:     }
50: 
51:     public function getStatusMessage(){
52: 
53:         $statusCodeMapping = array(
54:             "100"=>"Continue",
55:             "101"=>"Switching Protocols",
56:             "200"=>"OK",
57:             "201"=>"Created",
58:             "202"=>"Accepted",
59:             "203"=>"Non-Authoritative Information",
60:             "204"=>"No Content",
61:             "205"=>"Reset Content",
62:             "206"=>"Partial Content",
63:             "300"=>"Multiple Choices",
64:             "301"=>"Moved Permanently",
65:             "302"=>"Found",
66:             "303"=>"See Other",
67:             "304"=>"Not Modified",
68:             "305"=>"Use Proxy",
69:             "306"=>"(Unused)",
70:             "307"=>"Temporary Redirect",
71:             "400"=>"Bad Request",
72:             "401"=>"Unauthorized",
73:             "402"=>"Payment Required",
74:             "403"=>"Forbidden",
75:             "404"=>"Not Found",
76:             "405"=>"Method Not Allowed",
77:             "406"=>"Not Acceptable",
78:             "407"=>"Proxy Authentication Required",
79:             "408"=>"Request Timeout",
80:             "409"=>"Conflict",
81:             "410"=>"Gone",
82:             "411"=>"Length Required",
83:             "412"=>"Precondition Failed",
84:             "413"=>"Request Entity Too Large",
85:             "414"=>"Request-URI Too Long",
86:             "415"=>"Unsupported Media Type",
87:             "416"=>"Requested Range Not Satisfiable",
88:             "417"=>"Expectation Failed",
89:             "500"=>"Internal Server Error",
90:             "501"=>"Not Implemented",
91:             "502"=>"Bad Gateway",
92:             "503"=>"Service Unavailable",
93:             "504"=>"Gateway Timeout",
94:             "505"=>"HTTP Version Not Supported",
95:         );
96:         return isset($statusCodeMapping[$this->statusCode])? $statusCodeMapping[$this->statusCode]: "Unknown status";
97:     }
98: }
99: 
Mapbender3 API documenation API documentation generated by ApiGen 2.8.0