1: <?php
2:
3: namespace Mapbender\WmsBundle\Component;
4:
5: /**
6: * RequestInformation class.
7: *
8: * @author Paul Schmidt
9: */
10: class RequestInformation
11: {
12:
13: /**
14: * ORM\Column(type="string", nullable=true)
15: */
16: //@TODO Doctrine bug: "protected" replaced with "public"
17: public $httpGet;
18:
19: /**
20: * ORM\Column(type="string", nullable=true)
21: */
22: //@TODO Doctrine bug: "protected" replaced with "public"
23: public $httpPost;
24:
25: /**
26: * ORM\Column(type="array", nullable=true)
27: */
28: //@TODO Doctrine bug: "protected" replaced with "public"
29: public $formats;
30:
31: /**
32: * Creates a RequestInformation object from parameters
33: * @param array $parameters
34: */
35: public static function create(array $parameters)
36: {
37: if(is_array($parameters))
38: {
39: $rqi = new RequestInformation();
40: if(isset($parameters["httpPost"]))
41: {
42: $rqi->setHttpPost($parameters["httpPost"]);
43: }
44: if(isset($parameters["httpGet"]))
45: {
46: $rqi->setHttpGet($parameters["httpGet"]);
47: }
48: if(isset($parameters["formats"]))
49: {
50: $rqi->setFormats($parameters["formats"]);
51: }
52: if($this->getHttpGet() || $this->getHttpPost())
53: {
54: return $rqi;
55: }
56: }
57: return null;
58: }
59:
60: public function __construct()
61: {
62: $this->formats = array();
63: }
64:
65: /**
66: * Get httpGet
67: *
68: * @return string
69: */
70: public function getHttpGet()
71: {
72: return $this->httpGet;
73: }
74:
75: /**
76: * Set httpGet
77: * @param string $value
78: */
79: public function setHttpGet($value)
80: {
81: $this->httpGet = $value;
82: return $this;
83: }
84:
85: /**
86: * Get httpPost
87: *
88: * @return string
89: */
90: public function getHttpPost()
91: {
92: return $this->httpPost;
93: }
94:
95: /**
96: * Set httpPost
97: * @param string $value
98: */
99: public function setHttpPost($value)
100: {
101: $this->httpPost = $value;
102: return $this;
103: }
104:
105: /**
106: * Get formats
107: *
108: * @return array
109: */
110: public function getFormats()
111: {
112: return $this->formats;
113: }
114:
115: /**
116: * Set formats
117: * @param array $value
118: */
119: public function setFormats($value)
120: {
121: $this->formats = $value;
122: return $this;
123: }
124:
125: /**
126: * Add format
127: * @param string $value
128: */
129: public function addFormat($value)
130: {
131: $this->formats[] = $value;
132: return $this;
133: }
134:
135: /**
136: * Get object as array
137: *
138: * @return array
139: */
140: public function toArray()
141: {
142: return array(
143: "httpGet" => $this->httpGet,
144: "httpPost" => $this->httpPost,
145: "formats" => $this->formats
146: );
147: }
148:
149: }