1: <?php
2:
3: namespace Mapbender\CoreBundle\Component;
4:
5: /**
6: * Description of State
7: *
8: * @author Paul Schmidt
9: */
10: class StateHandler
11: {
12:
13: private $id;
14:
15: private $name;
16:
17: private $serverurl;
18:
19: private $slug;
20:
21: private $window;
22:
23: private $extent;
24:
25: private $maxextent;
26:
27: private $sources = array();
28:
29: /**
30: * Sets id
31: *
32: * @param type $value
33: * @return StateHandler
34: */
35: public function setId($value){
36: $this->id = $value;
37: return $this;
38: }
39:
40: /**
41: * Returns id
42: *
43: * @return integer
44: */
45: public function getId(){
46: return $this->id;
47: }
48:
49: /**
50: * Sets name
51: *
52: * @param string $value
53: * @return StateHandler
54: */
55: public function setName($value){
56: $this->name = $value;
57: return $this;
58: }
59:
60: /**
61: * Returns name
62: *
63: * @return string
64: */
65: public function getName(){
66: return $this->name;
67: }
68:
69:
70:
71: /**
72: * Sets serverurl
73: *
74: * @param string $value
75: * @return StateHandler
76: */
77: public function setServerurl($value){
78: $this->serverurl = $value;
79: return $this;
80: }
81:
82: /**
83: * Returns serverurl
84: *
85: * @return string
86: */
87: public function getServerurl(){
88: return $this->serverurl;
89: }
90:
91:
92:
93: /**
94: * Sets slug
95: *
96: * @param string $value
97: * @return StateHandler
98: */
99: public function setSlug($value){
100: $this->slug = $value;
101: return $this;
102: }
103:
104: /**
105: * Returns slug
106: *
107: * @return string
108: */
109: public function getSlug(){
110: return $this->slug;
111: }
112:
113:
114:
115: /**
116: * Sets window
117: *
118: * @param Size $value
119: * @return StateHandler
120: */
121: public function setWindow(Size $value){
122: $this->window = $value;
123: return $this;
124: }
125:
126: /**
127: * Returns window
128: *
129: * @return Size
130: */
131: public function getWindow(){
132: return $this->window;
133: }
134:
135:
136:
137: /**
138: * Sets extent
139: *
140: * @param BoundingBox $value
141: * @return StateHandler
142: */
143: public function setExtent(BoundingBox $value){
144: $this->extent = $value;
145: return $this;
146: }
147:
148: /**
149: * Returns extent
150: *
151: * @return BoundingBox
152: */
153: public function getExtent(){
154: return $this->extent;
155: }
156:
157:
158:
159: /**
160: * Sets maxextent
161: *
162: * @param BoundingBox $value
163: * @return StateHandler
164: */
165: public function setMaxextent(BoundingBox $value){
166: $this->maxextent = $value;
167: return $this;
168: }
169:
170: /**
171: * Returns maxextent
172: *
173: * @return BoundingBox
174: */
175: public function getMaxextent(){
176: return $this->maxextent;
177: }
178:
179: /**
180: * Sets sources
181: *
182: * @param array $value
183: * @return StateHandler
184: */
185: public function setSources($value){
186: $this->sources = $value;
187: return $this;
188: }
189:
190: /**
191: * Returns sources
192: *
193: * @return array
194: */
195: public function getSources(){
196: return $this->sources;
197: }
198:
199: /**
200: * Adds source
201: *
202: * @return StateHandler
203: */
204: public function addSource($value){
205: $this->sources[] = $value;
206: return $this;
207: }
208:
209: /**
210: * Creates a StateHandler from parameters
211: *
212: * @param array $json
213: * @return StateHandler
214: */
215: public static function create($json, $id = null, $name = null, $serverurl = null, $slug = null){
216: $sh = new StateHandler();
217: $sh->setId($id);
218: $sh->setName($name);
219: $sh->setServerurl($serverurl);
220: $sh->setSlug($slug);
221: $sh->setWindow(Size::create($json["window"]));
222: $sh->setExtent(BoundingBox::create($json["extent"]));
223: $sh->setMaxextent(BoundingBox::create($json["maxextent"]));
224: $sh->setSources($json["sources"]);
225: return $sh;
226: }
227:
228: public function toArray()
229: {
230: return array(
231: "window" => $this->window->toArray(),
232: "extent" => $this->extent->ToArray(),
233: "maxextent" => $this->maxextent->ToArray(),
234: "sources" => $this->sources);
235: }
236:
237: //
238: // /**
239: // * Sets
240: // *
241: // * @param type $value
242: // * @return StateHandler
243: // */
244: // public function set($value){
245: // $this-> = $value;
246: // return $this;
247: // }
248: //
249: // /**
250: // * Returns
251: // *
252: // * @return integer
253: // */
254: // public function get(){
255: // return $this->;
256: // }
257:
258: }
259:
260: ?>
261: