@@ -27,7 +27,7 @@ class Drawing
2727 * Convert pixels to EMU
2828 *
2929 * @param int $pValue Value in pixels
30- * @return int Value in EMU
30+ * @return int
3131 */
3232 public static function pixelsToEmu ($ pValue = 0 )
3333 {
@@ -38,22 +38,21 @@ public static function pixelsToEmu($pValue = 0)
3838 * Convert EMU to pixels
3939 *
4040 * @param int $pValue Value in EMU
41- * @return int Value in pixels
41+ * @return int
4242 */
4343 public static function emuToPixels ($ pValue = 0 )
4444 {
45- if ($ pValue != 0 ) {
46- return round ($ pValue / 9525 );
47- } else {
45+ if ($ pValue == 0 ) {
4846 return 0 ;
4947 }
48+ return round ($ pValue / 9525 );
5049 }
5150
5251 /**
5352 * Convert pixels to points
5453 *
5554 * @param int $pValue Value in pixels
56- * @return int Value in points
55+ * @return float
5756 */
5857 public static function pixelsToPoints ($ pValue = 0 )
5958 {
@@ -64,37 +63,35 @@ public static function pixelsToPoints($pValue = 0)
6463 * Convert points width to centimeters
6564 *
6665 * @param int $pValue Value in points
67- * @return int Value in centimeters
66+ * @return float
6867 */
6968 public static function pointsToCentimeters ($ pValue = 0 )
7069 {
71- if ($ pValue != 0 ) {
72- return ((($ pValue * 1.333333333 ) / self ::DPI_96 ) * 2.54 );
73- } else {
70+ if ($ pValue == 0 ) {
7471 return 0 ;
7572 }
73+ return ((($ pValue * 1.333333333 ) / self ::DPI_96 ) * 2.54 );
7674 }
7775
7876 /**
7977 * Convert points width to pixels
8078 *
8179 * @param int $pValue Value in points
82- * @return int Value in pixels
80+ * @return float
8381 */
8482 public static function pointsToPixels ($ pValue = 0 )
8583 {
86- if ($ pValue != 0 ) {
87- return $ pValue * 1.333333333 ;
88- } else {
84+ if ($ pValue == 0 ) {
8985 return 0 ;
9086 }
87+ return $ pValue * 1.333333333 ;
9188 }
9289
9390 /**
9491 * Convert pixels to centimeters
9592 *
9693 * @param int $pValue Value in pixels
97- * @return int Value in centimeters
94+ * @return float
9895 */
9996 public static function pixelsToCentimeters ($ pValue = 0 )
10097 {
@@ -106,22 +103,21 @@ public static function pixelsToCentimeters($pValue = 0)
106103 * Convert centimeters width to pixels
107104 *
108105 * @param int $pValue Value in centimeters
109- * @return int Value in pixels
106+ * @return float
110107 */
111108 public static function centimetersToPixels ($ pValue = 0 )
112109 {
113- if ($ pValue != 0 ) {
114- return ($ pValue / 2.54 ) * self ::DPI_96 ;
115- } else {
110+ if ($ pValue == 0 ) {
116111 return 0 ;
117112 }
113+ return ($ pValue / 2.54 ) * self ::DPI_96 ;
118114 }
119115
120116 /**
121117 * Convert degrees to angle
122118 *
123119 * @param int $pValue Degrees
124- * @return int Angle
120+ * @return int
125121 */
126122 public static function degreesToAngle ($ pValue = 0 )
127123 {
@@ -132,85 +128,84 @@ public static function degreesToAngle($pValue = 0)
132128 * Convert angle to degrees
133129 *
134130 * @param int $pValue Angle
135- * @return int Degrees
131+ * @return int
136132 */
137133 public static function angleToDegrees ($ pValue = 0 )
138134 {
139- if ($ pValue != 0 ) {
140- return round ($ pValue / 60000 );
141- } else {
135+ if ($ pValue == 0 ) {
142136 return 0 ;
143137 }
138+ return round ($ pValue / 60000 );
144139 }
145140
146141 /**
147142 * Convert centimeters width to twips
148143 *
149144 * @param integer $pValue
145+ * @return float
150146 */
151147 public static function centimetersToTwips ($ pValue = 0 )
152148 {
153- if ($ pValue != 0 ) {
154- return $ pValue * 566.928 ;
155- } else {
149+ if ($ pValue == 0 ) {
156150 return 0 ;
157151 }
152+ return $ pValue * 566.928 ;
158153 }
159154
160155 /**
161156 * Convert twips width to centimeters
162157 *
163158 * @param integer $pValue
159+ * @return float
164160 */
165161 public static function twipsToCentimeters ($ pValue = 0 )
166162 {
167- if ($ pValue != 0 ) {
168- return $ pValue / 566.928 ;
169- } else {
163+ if ($ pValue == 0 ) {
170164 return 0 ;
171165 }
166+ return $ pValue / 566.928 ;
172167 }
173168
174169 /**
175170 * Convert inches width to twips
176171 *
177172 * @param integer $pValue
173+ * @return float
178174 */
179175 public static function inchesToTwips ($ pValue = 0 )
180176 {
181- if ($ pValue != 0 ) {
182- return $ pValue * 1440 ;
183- } else {
177+ if ($ pValue == 0 ) {
184178 return 0 ;
185179 }
180+ return $ pValue * 1440 ;
186181 }
187182
188183 /**
189184 * Convert twips width to inches
190185 *
191186 * @param integer $pValue
187+ * @return float
192188 */
193189 public static function twipsToInches ($ pValue = 0 )
194190 {
195- if ($ pValue != 0 ) {
196- return $ pValue / 1440 ;
197- } else {
191+ if ($ pValue == 0 ) {
198192 return 0 ;
199193 }
194+ return $ pValue / 1440 ;
200195 }
201196
202197 /**
203198 * Convert twips width to pixels
204199 *
205200 * @param integer $pValue
201+ * @return float
206202 */
207203 public static function twipsToPixels ($ pValue = 0 )
208204 {
209- if ($ pValue != 0 ) {
210- return round ($ pValue / 15.873984 );
211- } else {
205+ if ($ pValue == 0 ) {
212206 return 0 ;
213207 }
208+ return round ($ pValue / 15.873984 );
214209 }
215210
216211 /**
0 commit comments