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($httpGet = null, $httpPost = null,
61: $formats = array())
62: {
63: $this->httpGet = $httpGet;
64: $this->httpPost = $httpPost;
65: $this->formats = $formats;
66: }
67:
68: /**
69: * Get httpGet
70: *
71: * @return string
72: */
73: public function getHttpGet()
74: {
75: return $this->httpGet;
76: }
77:
78: /**
79: * Set httpGet
80: * @param string $value
81: */
82: public function setHttpGet($value)
83: {
84: $this->httpGet = $value;
85: return $this;
86: }
87:
88: /**
89: * Get httpPost
90: *
91: * @return string
92: */
93: public function getHttpPost()
94: {
95: return $this->httpPost;
96: }
97:
98: /**
99: * Set httpPost
100: * @param string $value
101: */
102: public function setHttpPost($value)
103: {
104: $this->httpPost = $value;
105: return $this;
106: }
107:
108: /**
109: * Get formats
110: *
111: * @return array
112: */
113: public function getFormats()
114: {
115: return $this->formats;
116: }
117:
118: /**
119: * Set formats
120: * @param array $value
121: */
122: public function setFormats($value)
123: {
124: $this->formats = $value;
125: return $this;
126: }
127:
128: /**
129: * Add format
130: * @param string $value
131: */
132: public function addFormat($value)
133: {
134: $this->formats[] = $value;
135: return $this;
136: }
137:
138: /**
139: * Get object as array
140: *
141: * @return array
142: */
143: public function toArray()
144: {
145: return array(
146: "httpGet" => $this->httpGet,
147: "httpPost" => $this->httpPost,
148: "formats" => $this->formats
149: );
150: }
151:
152: }