1: <?php
2:
3: namespace Mapbender\WmsBundle\Component;
4:
5: /*
6: * To change this template, choose Tools | Templates
7: * and open the template in the editor.
8: */
9:
10: /**
11: * Description of Size
12: *
13: * @author Paul Schmidt
14: */
15: class Size
16: {
17: /**
18: * ORM\Column(type="integer", nullable=false)
19: */
20: //@TODO Doctrine bug: "protected" replaced with "public"
21: public $width = 0;
22:
23: /**
24: * ORM\Column(type="integer", nullable=false)
25: */
26: //@TODO Doctrine bug: "protected" replaced with "public"
27: public $height = 0;
28:
29: /**
30: *
31: * @param type $width width
32: * @param type $height height
33: */
34: public function __construct($width = null, $height = null)
35: {
36: $this->width = $width;
37: $this->height = $height;
38: }
39:
40: /**
41: * Sets a width
42: *
43: * @return Size
44: */
45: public function setWidth($width){
46: $this->width = $width;
47: return $this;
48: }
49:
50: /**
51: * Returns a width
52: *
53: * @return integer width
54: */
55: public function getWidth(){
56: return $this->width;
57: }
58:
59: /**
60: * Sets a height
61: *
62: * @return Size
63: */
64: public function setHeight($height){
65: $this->height = $height;
66: return $this;
67: }
68:
69: /**
70: * Returns a height
71: *
72: * @return integer height
73: */
74: public function getHeight(){
75: return $this->height;
76: }
77:
78: /**
79: * Creates a Size from parameters (array("width"=>xx,"height"=>yy))
80: *
81: * @param array $parameters
82: * @return Size
83: */
84: public static function create($parameters = array()){
85: return new Size(
86: isset($parameters["width"]) ? $parameters["width"] : null,
87: isset($parameters["height"]) ? $parameters["height"] : null);
88: }
89:
90: /**
91: * Returns a Size as an array
92: *
93: * @return array
94: */
95: public function toArray(){
96: return array("width" => $this->width, "height" => $this->height);
97: }
98: }
99:
100: ?>
101: