@@ -257,7 +257,9 @@ public function __construct($options = null)
257
257
if (is_array ($ options )) {
258
258
$ this ->setOptions ($ options );
259
259
}
260
- $ this ->_type = strtolower (substr (get_class ($ this ), strlen ($ this ->_barcodeNamespace ) + 1 ));
260
+ $ this ->_type = strtolower (
261
+ substr (get_class ($ this ), strlen ($ this ->_barcodeNamespace ) + 1 )
262
+ );
261
263
if ($ this ->_mandatoryChecksum ) {
262
264
$ this ->_withChecksum = true ;
263
265
$ this ->_withChecksumInText = true ;
@@ -580,7 +582,8 @@ public function setReverseColor()
580
582
*/
581
583
public function setOrientation ($ value )
582
584
{
583
- $ this ->_orientation = floatval ($ value ) - floor (floatval ($ value ) / 360 ) * 360 ;
585
+ $ value = floatval ($ value );
586
+ $ this ->_orientation = $ value - floor ($ value / 360 ) * 360 ;
584
587
return $ this ;
585
588
}
586
589
@@ -812,10 +815,12 @@ public function setFont($value)
812
815
$ this ->_font = $ value ;
813
816
} else {
814
817
require_once 'Zend/Barcode/Object/Exception.php ' ;
815
- throw new Zend_Barcode_Object_Exception (sprintf (
816
- 'Invalid font "%s" provided to setFont() ' ,
817
- $ value
818
- ));
818
+ throw new Zend_Barcode_Object_Exception (
819
+ sprintf (
820
+ 'Invalid font "%s" provided to setFont() ' ,
821
+ $ value
822
+ )
823
+ );
819
824
}
820
825
return $ this ;
821
826
}
@@ -912,12 +917,14 @@ protected function _addPolygon(array $points, $color = null, $filled = true)
912
917
if ($ color === null ) {
913
918
$ color = $ this ->_foreColor ;
914
919
}
915
- $ this ->_addInstruction (array (
916
- 'type ' => 'polygon ' ,
917
- 'points ' => $ points ,
918
- 'color ' => $ color ,
919
- 'filled ' => $ filled ,
920
- ));
920
+ $ this ->_addInstruction (
921
+ array (
922
+ 'type ' => 'polygon ' ,
923
+ 'points ' => $ points ,
924
+ 'color ' => $ color ,
925
+ 'filled ' => $ filled ,
926
+ )
927
+ );
921
928
}
922
929
923
930
/**
@@ -943,16 +950,18 @@ protected function _addText(
943
950
if ($ color === null ) {
944
951
$ color = $ this ->_foreColor ;
945
952
}
946
- $ this ->_addInstruction (array (
947
- 'type ' => 'text ' ,
948
- 'text ' => $ text ,
949
- 'size ' => $ size ,
950
- 'position ' => $ position ,
951
- 'font ' => $ font ,
952
- 'color ' => $ color ,
953
- 'alignment ' => $ alignment ,
954
- 'orientation ' => $ orientation ,
955
- ));
953
+ $ this ->_addInstruction (
954
+ array (
955
+ 'type ' => 'text ' ,
956
+ 'text ' => $ text ,
957
+ 'size ' => $ size ,
958
+ 'position ' => $ position ,
959
+ 'font ' => $ font ,
960
+ 'color ' => $ color ,
961
+ 'alignment ' => $ alignment ,
962
+ 'orientation ' => $ orientation ,
963
+ )
964
+ );
956
965
}
957
966
958
967
/**
@@ -1000,12 +1009,14 @@ protected function _checkRatio($min = 2, $max = 3)
1000
1009
$ ratio = $ this ->_barThickWidth / $ this ->_barThinWidth ;
1001
1010
if (!($ ratio >= $ min && $ ratio <= $ max )) {
1002
1011
require_once 'Zend/Barcode/Object/Exception.php ' ;
1003
- throw new Zend_Barcode_Object_Exception (sprintf (
1004
- 'Ratio thick/thin bar must be between %0.1f and %0.1f (actual %0.3f) ' ,
1005
- $ min ,
1006
- $ max ,
1007
- $ ratio
1008
- ));
1012
+ throw new Zend_Barcode_Object_Exception (
1013
+ sprintf (
1014
+ 'Ratio thick/thin bar must be between %0.1f and %0.1f (actual %0.3f) ' ,
1015
+ $ min ,
1016
+ $ max ,
1017
+ $ ratio
1018
+ )
1019
+ );
1009
1020
}
1010
1021
}
1011
1022
@@ -1068,7 +1079,9 @@ protected function _calculateBarcodeHeight()
1068
1079
$ textHeight += $ this ->_fontSize ;
1069
1080
$ extraHeight = 2 ;
1070
1081
}
1071
- return ($ this ->_barHeight + $ textHeight ) * $ this ->_factor + $ extraHeight ;
1082
+
1083
+ return ($ this ->_barHeight + $ textHeight ) * $ this ->_factor
1084
+ + $ extraHeight ;
1072
1085
}
1073
1086
1074
1087
/**
@@ -1081,8 +1094,16 @@ public function getHeight($recalculate = false)
1081
1094
{
1082
1095
if ($ this ->_height === null || $ recalculate ) {
1083
1096
$ this ->_height =
1084
- abs ($ this ->_calculateHeight () * cos ($ this ->_orientation / 180 * pi ()))
1085
- + abs ($ this ->_calculateWidth () * sin ($ this ->_orientation / 180 * pi ()));
1097
+ abs (
1098
+ $ this ->_calculateHeight () * cos (
1099
+ $ this ->_orientation / 180 * pi ()
1100
+ )
1101
+ )
1102
+ + abs (
1103
+ $ this ->_calculateWidth () * sin (
1104
+ $ this ->_orientation / 180 * pi ()
1105
+ )
1106
+ );
1086
1107
}
1087
1108
return $ this ->_height ;
1088
1109
}
@@ -1097,8 +1118,16 @@ public function getWidth($recalculate = false)
1097
1118
{
1098
1119
if ($ this ->_width === null || $ recalculate ) {
1099
1120
$ this ->_width =
1100
- abs ($ this ->_calculateWidth () * cos ($ this ->_orientation / 180 * pi ()))
1101
- + abs ($ this ->_calculateHeight () * sin ($ this ->_orientation / 180 * pi ()));
1121
+ abs (
1122
+ $ this ->_calculateWidth () * cos (
1123
+ $ this ->_orientation / 180 * pi ()
1124
+ )
1125
+ )
1126
+ + abs (
1127
+ $ this ->_calculateHeight () * sin (
1128
+ $ this ->_orientation / 180 * pi ()
1129
+ )
1130
+ );
1102
1131
}
1103
1132
return $ this ->_width ;
1104
1133
}
@@ -1174,7 +1203,11 @@ protected function _rotate($x1, $y1)
1174
1203
$ y2 = $ y1 * cos ($ this ->_orientation / 180 * pi ())
1175
1204
+ $ x1 * sin ($ this ->_orientation / 180 * pi ())
1176
1205
+ $ this ->getOffsetTop ();
1177
- return array (intval ($ x2 ) , intval ($ y2 ));
1206
+
1207
+ return array (
1208
+ intval ($ x2 ),
1209
+ intval ($ y2 )
1210
+ );
1178
1211
}
1179
1212
1180
1213
/**
@@ -1211,12 +1244,14 @@ protected function _drawBarcode()
1211
1244
);
1212
1245
$ point4 = $ this ->_rotate ($ this ->_calculateWidth () - 1 , 0 );
1213
1246
1214
- $ this ->_addPolygon (array (
1215
- $ point1 ,
1216
- $ point2 ,
1217
- $ point3 ,
1218
- $ point4
1219
- ), $ this ->_backgroundColor );
1247
+ $ this ->_addPolygon (
1248
+ array (
1249
+ $ point1 ,
1250
+ $ point2 ,
1251
+ $ point3 ,
1252
+ $ point4
1253
+ ), $ this ->_backgroundColor
1254
+ );
1220
1255
1221
1256
$ xpos += $ this ->getQuietZone ();
1222
1257
$ barLength = $ this ->_barHeight * $ this ->_factor ;
@@ -1234,12 +1269,14 @@ protected function _drawBarcode()
1234
1269
$ xpos + $ width - 1 ,
1235
1270
$ ypos + $ bar [2 ] * $ barLength
1236
1271
);
1237
- $ this ->_addPolygon (array (
1238
- $ point1 ,
1239
- $ point2 ,
1240
- $ point3 ,
1241
- $ point4 ,
1242
- ));
1272
+ $ this ->_addPolygon (
1273
+ array (
1274
+ $ point1 ,
1275
+ $ point2 ,
1276
+ $ point3 ,
1277
+ $ point4 ,
1278
+ )
1279
+ );
1243
1280
}
1244
1281
$ xpos += $ width ;
1245
1282
}
@@ -1260,13 +1297,15 @@ protected function _drawBorder()
1260
1297
$ this ->_calculateHeight () - 1
1261
1298
);
1262
1299
$ point4 = $ this ->_rotate (0 , $ this ->_calculateHeight () - 1 );
1263
- $ this ->_addPolygon (array (
1264
- $ point1 ,
1265
- $ point2 ,
1266
- $ point3 ,
1267
- $ point4 ,
1268
- $ point1 ,
1269
- ), $ this ->_foreColor , false );
1300
+ $ this ->_addPolygon (
1301
+ array (
1302
+ $ point1 ,
1303
+ $ point2 ,
1304
+ $ point3 ,
1305
+ $ point4 ,
1306
+ $ point1 ,
1307
+ ), $ this ->_foreColor , false
1308
+ );
1270
1309
}
1271
1310
}
1272
1311
@@ -1335,10 +1374,12 @@ protected function _validateText($value, $options = array())
1335
1374
{
1336
1375
$ validatorName = (isset ($ options ['validator ' ])) ? $ options ['validator ' ] : $ this ->getType ();
1337
1376
1338
- $ validator = new Zend_Validate_Barcode (array (
1339
- 'adapter ' => $ validatorName ,
1340
- 'checksum ' => false ,
1341
- ));
1377
+ $ validator = new Zend_Validate_Barcode (
1378
+ array (
1379
+ 'adapter ' => $ validatorName ,
1380
+ 'checksum ' => false ,
1381
+ )
1382
+ );
1342
1383
1343
1384
$ checksumCharacter = '' ;
1344
1385
$ withChecksum = false ;
@@ -1347,7 +1388,8 @@ protected function _validateText($value, $options = array())
1347
1388
$ withChecksum = true ;
1348
1389
}
1349
1390
1350
- $ value = $ this ->_addLeadingZeros ($ value , $ withChecksum ) . $ checksumCharacter ;
1391
+ $ value = $ this ->_addLeadingZeros ($ value , $ withChecksum )
1392
+ . $ checksumCharacter ;
1351
1393
1352
1394
if (!$ validator ->isValid ($ value )) {
1353
1395
$ message = implode ("\n" , $ validator ->getMessages ());
0 commit comments