Passed
Pull Request — master (#65)
by Eduardo
03:41
created
src/Legacy/Pdf.php 1 patch
Spacing   +224 added lines, -224 removed lines patch added patch discarded remove patch
@@ -7,129 +7,129 @@  discard block
 block discarded – undo
7 7
 class Pdf extends Fpdf
8 8
 {
9 9
     
10
-    private $t128;                                             // tabela de codigos 128
11
-    private $abcSet="";                                        // conjunto de caracteres legiveis em 128
12
-    private $aSet="";                                          // grupo A do conjunto de de caracteres legiveis
13
-    private $bSet="";                                          // grupo B do conjunto de caracteres legiveis
14
-    private $cSet="";                                          // grupo C do conjunto de caracteres legiveis
15
-    private $setFrom;                                          // converter de
16
-    private $setTo;                                            // converter para
17
-    private $jStart = array("A"=>103, "B"=>104, "C"=>105);     // Caracteres de seleção do grupo 128
18
-    private $jSwap = array("A"=>101, "B"=>100, "C"=>99);       // Caracteres de troca de grupo
10
+    private $t128; // tabela de codigos 128
11
+    private $abcSet = ""; // conjunto de caracteres legiveis em 128
12
+    private $aSet = ""; // grupo A do conjunto de de caracteres legiveis
13
+    private $bSet = ""; // grupo B do conjunto de caracteres legiveis
14
+    private $cSet = ""; // grupo C do conjunto de caracteres legiveis
15
+    private $setFrom; // converter de
16
+    private $setTo; // converter para
17
+    private $jStart = array("A"=>103, "B"=>104, "C"=>105); // Caracteres de seleção do grupo 128
18
+    private $jSwap = array("A"=>101, "B"=>100, "C"=>99); // Caracteres de troca de grupo
19 19
 
20 20
     public function __construct($orientation = 'P', $unit = 'mm', $format = 'A4')
21 21
     {
22 22
         //passar parametros para a classe principal
23 23
         parent::__construct($orientation, $unit, $format);
24 24
         // composição dos caracteres do barcode 128
25
-        $this->t128[] = array(2, 1, 2, 2, 2, 2);           //0 : [ ]
26
-        $this->t128[] = array(2, 2, 2, 1, 2, 2);           //1 : [!]
27
-        $this->t128[] = array(2, 2, 2, 2, 2, 1);           //2 : ["]
28
-        $this->t128[] = array(1, 2, 1, 2, 2, 3);           //3 : [#]
29
-        $this->t128[] = array(1, 2, 1, 3, 2, 2);           //4 : [$]
30
-        $this->t128[] = array(1, 3, 1, 2, 2, 2);           //5 : [%]
31
-        $this->t128[] = array(1, 2, 2, 2, 1, 3);           //6 : [&]
32
-        $this->t128[] = array(1, 2, 2, 3, 1, 2);           //7 : [']
33
-        $this->t128[] = array(1, 3, 2, 2, 1, 2);           //8 : [(]
34
-        $this->t128[] = array(2, 2, 1, 2, 1, 3);           //9 : [)]
35
-        $this->t128[] = array(2, 2, 1, 3, 1, 2);           //10 : [*]
36
-        $this->t128[] = array(2, 3, 1, 2, 1, 2);           //11 : [+]
37
-        $this->t128[] = array(1, 1, 2, 2, 3, 2);           //12 : [,]
38
-        $this->t128[] = array(1, 2, 2, 1, 3, 2);           //13 : [-]
39
-        $this->t128[] = array(1, 2, 2, 2, 3, 1);           //14 : [.]
40
-        $this->t128[] = array(1, 1, 3, 2, 2, 2);           //15 : [/]
41
-        $this->t128[] = array(1, 2, 3, 1, 2, 2);           //16 : [0]
42
-        $this->t128[] = array(1, 2, 3, 2, 2, 1);           //17 : [1]
43
-        $this->t128[] = array(2, 2, 3, 2, 1, 1);           //18 : [2]
44
-        $this->t128[] = array(2, 2, 1, 1, 3, 2);           //19 : [3]
45
-        $this->t128[] = array(2, 2, 1, 2, 3, 1);           //20 : [4]
46
-        $this->t128[] = array(2, 1, 3, 2, 1, 2);           //21 : [5]
47
-        $this->t128[] = array(2, 2, 3, 1, 1, 2);           //22 : [6]
48
-        $this->t128[] = array(3, 1, 2, 1, 3, 1);           //23 : [7]
49
-        $this->t128[] = array(3, 1, 1, 2, 2, 2);           //24 : [8]
50
-        $this->t128[] = array(3, 2, 1, 1, 2, 2);           //25 : [9]
51
-        $this->t128[] = array(3, 2, 1, 2, 2, 1);           //26 : [:]
52
-        $this->t128[] = array(3, 1, 2, 2, 1, 2);           //27 : [;]
53
-        $this->t128[] = array(3, 2, 2, 1, 1, 2);           //28 : [<]
54
-        $this->t128[] = array(3, 2, 2, 2, 1, 1);           //29 : [=]
55
-        $this->t128[] = array(2, 1, 2, 1, 2, 3);           //30 : [>]
56
-        $this->t128[] = array(2, 1, 2, 3, 2, 1);           //31 : [?]
57
-        $this->t128[] = array(2, 3, 2, 1, 2, 1);           //32 : [@]
58
-        $this->t128[] = array(1, 1, 1, 3, 2, 3);           //33 : [A]
59
-        $this->t128[] = array(1, 3, 1, 1, 2, 3);           //34 : [B]
60
-        $this->t128[] = array(1, 3, 1, 3, 2, 1);           //35 : [C]
61
-        $this->t128[] = array(1, 1, 2, 3, 1, 3);           //36 : [D]
62
-        $this->t128[] = array(1, 3, 2, 1, 1, 3);           //37 : [E]
63
-        $this->t128[] = array(1, 3, 2, 3, 1, 1);           //38 : [F]
64
-        $this->t128[] = array(2, 1, 1, 3, 1, 3);           //39 : [G]
65
-        $this->t128[] = array(2, 3, 1, 1, 1, 3);           //40 : [H]
66
-        $this->t128[] = array(2, 3, 1, 3, 1, 1);           //41 : [I]
67
-        $this->t128[] = array(1, 1, 2, 1, 3, 3);           //42 : [J]
68
-        $this->t128[] = array(1, 1, 2, 3, 3, 1);           //43 : [K]
69
-        $this->t128[] = array(1, 3, 2, 1, 3, 1);           //44 : [L]
70
-        $this->t128[] = array(1, 1, 3, 1, 2, 3);           //45 : [M]
71
-        $this->t128[] = array(1, 1, 3, 3, 2, 1);           //46 : [N]
72
-        $this->t128[] = array(1, 3, 3, 1, 2, 1);           //47 : [O]
73
-        $this->t128[] = array(3, 1, 3, 1, 2, 1);           //48 : [P]
74
-        $this->t128[] = array(2, 1, 1, 3, 3, 1);           //49 : [Q]
75
-        $this->t128[] = array(2, 3, 1, 1, 3, 1);           //50 : [R]
76
-        $this->t128[] = array(2, 1, 3, 1, 1, 3);           //51 : [S]
77
-        $this->t128[] = array(2, 1, 3, 3, 1, 1);           //52 : [T]
78
-        $this->t128[] = array(2, 1, 3, 1, 3, 1);           //53 : [U]
79
-        $this->t128[] = array(3, 1, 1, 1, 2, 3);           //54 : [V]
80
-        $this->t128[] = array(3, 1, 1, 3, 2, 1);           //55 : [W]
81
-        $this->t128[] = array(3, 3, 1, 1, 2, 1);           //56 : [X]
82
-        $this->t128[] = array(3, 1, 2, 1, 1, 3);           //57 : [Y]
83
-        $this->t128[] = array(3, 1, 2, 3, 1, 1);           //58 : [Z]
84
-        $this->t128[] = array(3, 3, 2, 1, 1, 1);           //59 : [[]
85
-        $this->t128[] = array(3, 1, 4, 1, 1, 1);           //60 : [\]
86
-        $this->t128[] = array(2, 2, 1, 4, 1, 1);           //61 : []]
87
-        $this->t128[] = array(4, 3, 1, 1, 1, 1);           //62 : [^]
88
-        $this->t128[] = array(1, 1, 1, 2, 2, 4);           //63 : [_]
89
-        $this->t128[] = array(1, 1, 1, 4, 2, 2);           //64 : [`]
90
-        $this->t128[] = array(1, 2, 1, 1, 2, 4);           //65 : [a]
91
-        $this->t128[] = array(1, 2, 1, 4, 2, 1);           //66 : [b]
92
-        $this->t128[] = array(1, 4, 1, 1, 2, 2);           //67 : [c]
93
-        $this->t128[] = array(1, 4, 1, 2, 2, 1);           //68 : [d]
94
-        $this->t128[] = array(1, 1, 2, 2, 1, 4);           //69 : [e]
95
-        $this->t128[] = array(1, 1, 2, 4, 1, 2);           //70 : [f]
96
-        $this->t128[] = array(1, 2, 2, 1, 1, 4);           //71 : [g]
97
-        $this->t128[] = array(1, 2, 2, 4, 1, 1);           //72 : [h]
98
-        $this->t128[] = array(1, 4, 2, 1, 1, 2);           //73 : [i]
99
-        $this->t128[] = array(1, 4, 2, 2, 1, 1);           //74 : [j]
100
-        $this->t128[] = array(2, 4, 1, 2, 1, 1);           //75 : [k]
101
-        $this->t128[] = array(2, 2, 1, 1, 1, 4);           //76 : [l]
102
-        $this->t128[] = array(4, 1, 3, 1, 1, 1);           //77 : [m]
103
-        $this->t128[] = array(2, 4, 1, 1, 1, 2);           //78 : [n]
104
-        $this->t128[] = array(1, 3, 4, 1, 1, 1);           //79 : [o]
105
-        $this->t128[] = array(1, 1, 1, 2, 4, 2);           //80 : [p]
106
-        $this->t128[] = array(1, 2, 1, 1, 4, 2);           //81 : [q]
107
-        $this->t128[] = array(1, 2, 1, 2, 4, 1);           //82 : [r]
108
-        $this->t128[] = array(1, 1, 4, 2, 1, 2);           //83 : [s]
109
-        $this->t128[] = array(1, 2, 4, 1, 1, 2);           //84 : [t]
110
-        $this->t128[] = array(1, 2, 4, 2, 1, 1);           //85 : [u]
111
-        $this->t128[] = array(4, 1, 1, 2, 1, 2);           //86 : [v]
112
-        $this->t128[] = array(4, 2, 1, 1, 1, 2);           //87 : [w]
113
-        $this->t128[] = array(4, 2, 1, 2, 1, 1);           //88 : [x]
114
-        $this->t128[] = array(2, 1, 2, 1, 4, 1);           //89 : [y]
115
-        $this->t128[] = array(2, 1, 4, 1, 2, 1);           //90 : [z]
116
-        $this->t128[] = array(4, 1, 2, 1, 2, 1);           //91 : [{]
117
-        $this->t128[] = array(1, 1, 1, 1, 4, 3);           //92 : [|]
118
-        $this->t128[] = array(1, 1, 1, 3, 4, 1);           //93 : [}]
119
-        $this->t128[] = array(1, 3, 1, 1, 4, 1);           //94 : [~]
120
-        $this->t128[] = array(1, 1, 4, 1, 1, 3);           //95 : [DEL]
121
-        $this->t128[] = array(1, 1, 4, 3, 1, 1);           //96 : [FNC3]
122
-        $this->t128[] = array(4, 1, 1, 1, 1, 3);           //97 : [FNC2]
123
-        $this->t128[] = array(4, 1, 1, 3, 1, 1);           //98 : [SHIFT]
124
-        $this->t128[] = array(1, 1, 3, 1, 4, 1);           //99 : [Cswap]
125
-        $this->t128[] = array(1, 1, 4, 1, 3, 1);           //100 : [Bswap]
126
-        $this->t128[] = array(3, 1, 1, 1, 4, 1);           //101 : [Aswap]
127
-        $this->t128[] = array(4, 1, 1, 1, 3, 1);           //102 : [FNC1]
128
-        $this->t128[] = array(2, 1, 1, 4, 1, 2);           //103 : [Astart]
129
-        $this->t128[] = array(2, 1, 1, 2, 1, 4);           //104 : [Bstart]
130
-        $this->t128[] = array(2, 1, 1, 2, 3, 2);           //105 : [Cstart]
131
-        $this->t128[] = array(2, 3, 3, 1, 1, 1);           //106 : [STOP]
132
-        $this->t128[] = array(2, 1);                       //107 : [END BAR]
25
+        $this->t128[] = array(2, 1, 2, 2, 2, 2); //0 : [ ]
26
+        $this->t128[] = array(2, 2, 2, 1, 2, 2); //1 : [!]
27
+        $this->t128[] = array(2, 2, 2, 2, 2, 1); //2 : ["]
28
+        $this->t128[] = array(1, 2, 1, 2, 2, 3); //3 : [#]
29
+        $this->t128[] = array(1, 2, 1, 3, 2, 2); //4 : [$]
30
+        $this->t128[] = array(1, 3, 1, 2, 2, 2); //5 : [%]
31
+        $this->t128[] = array(1, 2, 2, 2, 1, 3); //6 : [&]
32
+        $this->t128[] = array(1, 2, 2, 3, 1, 2); //7 : [']
33
+        $this->t128[] = array(1, 3, 2, 2, 1, 2); //8 : [(]
34
+        $this->t128[] = array(2, 2, 1, 2, 1, 3); //9 : [)]
35
+        $this->t128[] = array(2, 2, 1, 3, 1, 2); //10 : [*]
36
+        $this->t128[] = array(2, 3, 1, 2, 1, 2); //11 : [+]
37
+        $this->t128[] = array(1, 1, 2, 2, 3, 2); //12 : [,]
38
+        $this->t128[] = array(1, 2, 2, 1, 3, 2); //13 : [-]
39
+        $this->t128[] = array(1, 2, 2, 2, 3, 1); //14 : [.]
40
+        $this->t128[] = array(1, 1, 3, 2, 2, 2); //15 : [/]
41
+        $this->t128[] = array(1, 2, 3, 1, 2, 2); //16 : [0]
42
+        $this->t128[] = array(1, 2, 3, 2, 2, 1); //17 : [1]
43
+        $this->t128[] = array(2, 2, 3, 2, 1, 1); //18 : [2]
44
+        $this->t128[] = array(2, 2, 1, 1, 3, 2); //19 : [3]
45
+        $this->t128[] = array(2, 2, 1, 2, 3, 1); //20 : [4]
46
+        $this->t128[] = array(2, 1, 3, 2, 1, 2); //21 : [5]
47
+        $this->t128[] = array(2, 2, 3, 1, 1, 2); //22 : [6]
48
+        $this->t128[] = array(3, 1, 2, 1, 3, 1); //23 : [7]
49
+        $this->t128[] = array(3, 1, 1, 2, 2, 2); //24 : [8]
50
+        $this->t128[] = array(3, 2, 1, 1, 2, 2); //25 : [9]
51
+        $this->t128[] = array(3, 2, 1, 2, 2, 1); //26 : [:]
52
+        $this->t128[] = array(3, 1, 2, 2, 1, 2); //27 : [;]
53
+        $this->t128[] = array(3, 2, 2, 1, 1, 2); //28 : [<]
54
+        $this->t128[] = array(3, 2, 2, 2, 1, 1); //29 : [=]
55
+        $this->t128[] = array(2, 1, 2, 1, 2, 3); //30 : [>]
56
+        $this->t128[] = array(2, 1, 2, 3, 2, 1); //31 : [?]
57
+        $this->t128[] = array(2, 3, 2, 1, 2, 1); //32 : [@]
58
+        $this->t128[] = array(1, 1, 1, 3, 2, 3); //33 : [A]
59
+        $this->t128[] = array(1, 3, 1, 1, 2, 3); //34 : [B]
60
+        $this->t128[] = array(1, 3, 1, 3, 2, 1); //35 : [C]
61
+        $this->t128[] = array(1, 1, 2, 3, 1, 3); //36 : [D]
62
+        $this->t128[] = array(1, 3, 2, 1, 1, 3); //37 : [E]
63
+        $this->t128[] = array(1, 3, 2, 3, 1, 1); //38 : [F]
64
+        $this->t128[] = array(2, 1, 1, 3, 1, 3); //39 : [G]
65
+        $this->t128[] = array(2, 3, 1, 1, 1, 3); //40 : [H]
66
+        $this->t128[] = array(2, 3, 1, 3, 1, 1); //41 : [I]
67
+        $this->t128[] = array(1, 1, 2, 1, 3, 3); //42 : [J]
68
+        $this->t128[] = array(1, 1, 2, 3, 3, 1); //43 : [K]
69
+        $this->t128[] = array(1, 3, 2, 1, 3, 1); //44 : [L]
70
+        $this->t128[] = array(1, 1, 3, 1, 2, 3); //45 : [M]
71
+        $this->t128[] = array(1, 1, 3, 3, 2, 1); //46 : [N]
72
+        $this->t128[] = array(1, 3, 3, 1, 2, 1); //47 : [O]
73
+        $this->t128[] = array(3, 1, 3, 1, 2, 1); //48 : [P]
74
+        $this->t128[] = array(2, 1, 1, 3, 3, 1); //49 : [Q]
75
+        $this->t128[] = array(2, 3, 1, 1, 3, 1); //50 : [R]
76
+        $this->t128[] = array(2, 1, 3, 1, 1, 3); //51 : [S]
77
+        $this->t128[] = array(2, 1, 3, 3, 1, 1); //52 : [T]
78
+        $this->t128[] = array(2, 1, 3, 1, 3, 1); //53 : [U]
79
+        $this->t128[] = array(3, 1, 1, 1, 2, 3); //54 : [V]
80
+        $this->t128[] = array(3, 1, 1, 3, 2, 1); //55 : [W]
81
+        $this->t128[] = array(3, 3, 1, 1, 2, 1); //56 : [X]
82
+        $this->t128[] = array(3, 1, 2, 1, 1, 3); //57 : [Y]
83
+        $this->t128[] = array(3, 1, 2, 3, 1, 1); //58 : [Z]
84
+        $this->t128[] = array(3, 3, 2, 1, 1, 1); //59 : [[]
85
+        $this->t128[] = array(3, 1, 4, 1, 1, 1); //60 : [\]
86
+        $this->t128[] = array(2, 2, 1, 4, 1, 1); //61 : []]
87
+        $this->t128[] = array(4, 3, 1, 1, 1, 1); //62 : [^]
88
+        $this->t128[] = array(1, 1, 1, 2, 2, 4); //63 : [_]
89
+        $this->t128[] = array(1, 1, 1, 4, 2, 2); //64 : [`]
90
+        $this->t128[] = array(1, 2, 1, 1, 2, 4); //65 : [a]
91
+        $this->t128[] = array(1, 2, 1, 4, 2, 1); //66 : [b]
92
+        $this->t128[] = array(1, 4, 1, 1, 2, 2); //67 : [c]
93
+        $this->t128[] = array(1, 4, 1, 2, 2, 1); //68 : [d]
94
+        $this->t128[] = array(1, 1, 2, 2, 1, 4); //69 : [e]
95
+        $this->t128[] = array(1, 1, 2, 4, 1, 2); //70 : [f]
96
+        $this->t128[] = array(1, 2, 2, 1, 1, 4); //71 : [g]
97
+        $this->t128[] = array(1, 2, 2, 4, 1, 1); //72 : [h]
98
+        $this->t128[] = array(1, 4, 2, 1, 1, 2); //73 : [i]
99
+        $this->t128[] = array(1, 4, 2, 2, 1, 1); //74 : [j]
100
+        $this->t128[] = array(2, 4, 1, 2, 1, 1); //75 : [k]
101
+        $this->t128[] = array(2, 2, 1, 1, 1, 4); //76 : [l]
102
+        $this->t128[] = array(4, 1, 3, 1, 1, 1); //77 : [m]
103
+        $this->t128[] = array(2, 4, 1, 1, 1, 2); //78 : [n]
104
+        $this->t128[] = array(1, 3, 4, 1, 1, 1); //79 : [o]
105
+        $this->t128[] = array(1, 1, 1, 2, 4, 2); //80 : [p]
106
+        $this->t128[] = array(1, 2, 1, 1, 4, 2); //81 : [q]
107
+        $this->t128[] = array(1, 2, 1, 2, 4, 1); //82 : [r]
108
+        $this->t128[] = array(1, 1, 4, 2, 1, 2); //83 : [s]
109
+        $this->t128[] = array(1, 2, 4, 1, 1, 2); //84 : [t]
110
+        $this->t128[] = array(1, 2, 4, 2, 1, 1); //85 : [u]
111
+        $this->t128[] = array(4, 1, 1, 2, 1, 2); //86 : [v]
112
+        $this->t128[] = array(4, 2, 1, 1, 1, 2); //87 : [w]
113
+        $this->t128[] = array(4, 2, 1, 2, 1, 1); //88 : [x]
114
+        $this->t128[] = array(2, 1, 2, 1, 4, 1); //89 : [y]
115
+        $this->t128[] = array(2, 1, 4, 1, 2, 1); //90 : [z]
116
+        $this->t128[] = array(4, 1, 2, 1, 2, 1); //91 : [{]
117
+        $this->t128[] = array(1, 1, 1, 1, 4, 3); //92 : [|]
118
+        $this->t128[] = array(1, 1, 1, 3, 4, 1); //93 : [}]
119
+        $this->t128[] = array(1, 3, 1, 1, 4, 1); //94 : [~]
120
+        $this->t128[] = array(1, 1, 4, 1, 1, 3); //95 : [DEL]
121
+        $this->t128[] = array(1, 1, 4, 3, 1, 1); //96 : [FNC3]
122
+        $this->t128[] = array(4, 1, 1, 1, 1, 3); //97 : [FNC2]
123
+        $this->t128[] = array(4, 1, 1, 3, 1, 1); //98 : [SHIFT]
124
+        $this->t128[] = array(1, 1, 3, 1, 4, 1); //99 : [Cswap]
125
+        $this->t128[] = array(1, 1, 4, 1, 3, 1); //100 : [Bswap]
126
+        $this->t128[] = array(3, 1, 1, 1, 4, 1); //101 : [Aswap]
127
+        $this->t128[] = array(4, 1, 1, 1, 3, 1); //102 : [FNC1]
128
+        $this->t128[] = array(2, 1, 1, 4, 1, 2); //103 : [Astart]
129
+        $this->t128[] = array(2, 1, 1, 2, 1, 4); //104 : [Bstart]
130
+        $this->t128[] = array(2, 1, 1, 2, 3, 2); //105 : [Cstart]
131
+        $this->t128[] = array(2, 3, 3, 1, 1, 1); //106 : [STOP]
132
+        $this->t128[] = array(2, 1); //107 : [END BAR]
133 133
         for ($i = 32; $i <= 95; $i++) {   // conjunto de caracteres
134 134
             $this->abcSet .= chr($i);
135 135
         }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
             $this->abcSet .= chr($i);
144 144
             $this->bSet .= chr($i);
145 145
         }
146
-        $this->cSet="0123456789";
146
+        $this->cSet = "0123456789";
147 147
         for ($i = 0; $i < 96; $i++) {
148 148
             // convertendo grupos A & B
149 149
             if (isset($this->setFrom["A"])) {
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
                 $this->setFrom["B"] .= chr($i + 32);
154 154
             }
155 155
             if (isset($this->setTo["A"])) {
156
-                $this->setTo["A"] .= chr(($i < 32) ? $i+64 : $i-32);
156
+                $this->setTo["A"] .= chr(($i < 32) ? $i + 64 : $i - 32);
157 157
             }
158 158
             if (isset($this->setTo["A"])) {
159 159
                 $this->setTo["B"] .= chr($i);
@@ -167,21 +167,21 @@  discard block
 block discarded – undo
167 167
      */
168 168
     public function code128($x, $y, $code, $w, $h)
169 169
     {
170
-        $Aguid="";
171
-        $Bguid="";
172
-        $Cguid="";
173
-        for ($i=0; $i < strlen($code); $i++) {
174
-            $needle=substr($code, $i, 1);
175
-            $Aguid .= ((strpos($this->aSet, $needle)===false) ? "N" : "O");
176
-            $Bguid .= ((strpos($this->bSet, $needle)===false) ? "N" : "O");
177
-            $Cguid .= ((strpos($this->cSet, $needle)===false) ? "N" : "O");
170
+        $Aguid = "";
171
+        $Bguid = "";
172
+        $Cguid = "";
173
+        for ($i = 0; $i < strlen($code); $i++) {
174
+            $needle = substr($code, $i, 1);
175
+            $Aguid .= ((strpos($this->aSet, $needle) === false) ? "N" : "O");
176
+            $Bguid .= ((strpos($this->bSet, $needle) === false) ? "N" : "O");
177
+            $Cguid .= ((strpos($this->cSet, $needle) === false) ? "N" : "O");
178 178
         }
179 179
         $SminiC = "OOOO";
180 180
         $IminiC = 4;
181 181
         $crypt = "";
182 182
         while ($code > "") {
183 183
             $i = strpos($Cguid, $SminiC);
184
-            if ($i!==false) {
184
+            if ($i !== false) {
185 185
                 $Aguid [$i] = "N";
186 186
                 $Bguid [$i] = "N";
187 187
             }
@@ -191,10 +191,10 @@  discard block
 block discarded – undo
191 191
                 if ($made === false) {
192 192
                     $made = strlen($Cguid);
193 193
                 }
194
-                if (fmod($made, 2)==1) {
194
+                if (fmod($made, 2) == 1) {
195 195
                     $made--;
196 196
                 }
197
-                for ($i=0; $i < $made;
197
+                for ($i = 0; $i < $made;
198 198
                 $i += 2) {
199 199
                     $crypt .= chr(strval(substr($code, $i, 2)));
200 200
                 }
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
                 if ($madeB === false) {
209 209
                     $madeB = strlen($Bguid);
210 210
                 }
211
-                $made = (($madeA < $madeB) ? $madeB : $madeA );
212
-                $jeu = (($madeA < $madeB) ? "B" : "A" );
211
+                $made = (($madeA < $madeB) ? $madeB : $madeA);
212
+                $jeu = (($madeA < $madeB) ? "B" : "A");
213 213
                 $jeuguid = $jeu . "guid";
214 214
                 $crypt .= chr(($crypt > "") ? $this->jSwap["$jeu"] : $this->jStart["$jeu"]);
215 215
                 $crypt .= strtr(substr($code, 0, $made), $this->setFrom[$jeu], $this->setTo[$jeu]);
@@ -220,18 +220,18 @@  discard block
 block discarded – undo
220 220
             $Cguid = substr($Cguid, $made);
221 221
         }
222 222
         $check = ord($crypt[0]);
223
-        for ($i=0; $i<strlen($crypt); $i++) {
223
+        for ($i = 0; $i < strlen($crypt); $i++) {
224 224
             $check += (ord($crypt[$i]) * $i);
225 225
         }
226 226
         $check %= 103;
227 227
         $crypt .= chr($check) . chr(106) . chr(107);
228 228
         $i = (strlen($crypt) * 11) - 8;
229
-        $modul = $w/$i;
230
-        for ($i=0; $i<strlen($crypt); $i++) {
229
+        $modul = $w / $i;
230
+        for ($i = 0; $i < strlen($crypt); $i++) {
231 231
             $c = $this->t128[ord($crypt[$i])];
232
-            for ($j=0; $j<count($c); $j++) {
233
-                $this->Rect($x, $y, $c[$j]*$modul, $h, "F");
234
-                $x += ($c[$j++]+$c[$j])*$modul;
232
+            for ($j = 0; $j < count($c); $j++) {
233
+                $this->Rect($x, $y, $c[$j] * $modul, $h, "F");
234
+                $x += ($c[$j++] + $c[$j]) * $modul;
235 235
             }
236 236
         }
237 237
     }
@@ -256,11 +256,11 @@  discard block
 block discarded – undo
256 256
         }
257 257
         $this->angle = $angle;
258 258
         if ($angle != 0) {
259
-            $angle *= M_PI/180;
259
+            $angle *= M_PI / 180;
260 260
             $c = cos($angle);
261 261
             $s = sin($angle);
262
-            $cx =$x*$this->k;
263
-            $cy = ($this->h-$y)*$this->k;
262
+            $cx = $x * $this->k;
263
+            $cy = ($this->h - $y) * $this->k;
264 264
             $this->out(
265 265
                 sprintf(
266 266
                     'q %.5F %.5F %.5F %.5F %.2F %.2F cm 1 0 0 1 %.2F %.2F cm',
@@ -299,40 +299,40 @@  discard block
 block discarded – undo
299 299
         } else {
300 300
             $op = 'S';
301 301
         }
302
-        $MyArc = 4/3 * (sqrt(2) - 1);
303
-        $this->out(sprintf('%.2F %.2F m', ($x+$r)*$k, ($hp-$y)*$k));
304
-        $xc = $x+$w-$r;
305
-        $yc = $y+$r;
306
-        $this->out(sprintf('%.2F %.2F l', $xc*$k, ($hp-$y)*$k));
307
-        if (strpos($corners, '2')===false) {
308
-            $this->out(sprintf('%.2F %.2F l', ($x+$w)*$k, ($hp-$y)*$k));
302
+        $MyArc = 4 / 3 * (sqrt(2) - 1);
303
+        $this->out(sprintf('%.2F %.2F m', ($x + $r) * $k, ($hp - $y) * $k));
304
+        $xc = $x + $w - $r;
305
+        $yc = $y + $r;
306
+        $this->out(sprintf('%.2F %.2F l', $xc * $k, ($hp - $y) * $k));
307
+        if (strpos($corners, '2') === false) {
308
+            $this->out(sprintf('%.2F %.2F l', ($x + $w) * $k, ($hp - $y) * $k));
309 309
         } else {
310
-            $this->arc($xc + $r*$MyArc, $yc - $r, $xc + $r, $yc - $r*$MyArc, $xc + $r, $yc);
310
+            $this->arc($xc + $r * $MyArc, $yc - $r, $xc + $r, $yc - $r * $MyArc, $xc + $r, $yc);
311 311
         }
312
-        $xc = $x+$w-$r;
313
-        $yc = $y+$h-$r;
314
-        $this->out(sprintf('%.2F %.2F l', ($x+$w)*$k, ($hp-$yc)*$k));
315
-        if (strpos($corners, '3')===false) {
316
-            $this->out(sprintf('%.2F %.2F l', ($x+$w)*$k, ($hp-($y+$h))*$k));
312
+        $xc = $x + $w - $r;
313
+        $yc = $y + $h - $r;
314
+        $this->out(sprintf('%.2F %.2F l', ($x + $w) * $k, ($hp - $yc) * $k));
315
+        if (strpos($corners, '3') === false) {
316
+            $this->out(sprintf('%.2F %.2F l', ($x + $w) * $k, ($hp - ($y + $h)) * $k));
317 317
         } else {
318
-            $this->arc($xc + $r, $yc + $r*$MyArc, $xc + $r*$MyArc, $yc + $r, $xc, $yc + $r);
318
+            $this->arc($xc + $r, $yc + $r * $MyArc, $xc + $r * $MyArc, $yc + $r, $xc, $yc + $r);
319 319
         }
320
-        $xc = $x+$r;
321
-        $yc = $y+$h-$r;
322
-        $this->out(sprintf('%.2F %.2F l', $xc*$k, ($hp-($y+$h))*$k));
323
-        if (strpos($corners, '4')===false) {
324
-            $this->out(sprintf('%.2F %.2F l', ($x)*$k, ($hp-($y+$h))*$k));
320
+        $xc = $x + $r;
321
+        $yc = $y + $h - $r;
322
+        $this->out(sprintf('%.2F %.2F l', $xc * $k, ($hp - ($y + $h)) * $k));
323
+        if (strpos($corners, '4') === false) {
324
+            $this->out(sprintf('%.2F %.2F l', ($x) * $k, ($hp - ($y + $h)) * $k));
325 325
         } else {
326
-            $this->arc($xc - $r*$MyArc, $yc + $r, $xc - $r, $yc + $r*$MyArc, $xc - $r, $yc);
327
-        }
328
-        $xc = $x+$r ;
329
-        $yc = $y+$r;
330
-        $this->out(sprintf('%.2F %.2F l', ($x)*$k, ($hp-$yc)*$k));
331
-        if (strpos($corners, '1')===false) {
332
-            $this->out(sprintf('%.2F %.2F l', ($x)*$k, ($hp-$y)*$k));
333
-            $this->out(sprintf('%.2F %.2F l', ($x+$r)*$k, ($hp-$y)*$k));
326
+            $this->arc($xc - $r * $MyArc, $yc + $r, $xc - $r, $yc + $r * $MyArc, $xc - $r, $yc);
327
+        }
328
+        $xc = $x + $r;
329
+        $yc = $y + $r;
330
+        $this->out(sprintf('%.2F %.2F l', ($x) * $k, ($hp - $yc) * $k));
331
+        if (strpos($corners, '1') === false) {
332
+            $this->out(sprintf('%.2F %.2F l', ($x) * $k, ($hp - $y) * $k));
333
+            $this->out(sprintf('%.2F %.2F l', ($x + $r) * $k, ($hp - $y) * $k));
334 334
         } else {
335
-            $this->arc($xc - $r, $yc - $r*$MyArc, $xc - $r*$MyArc, $yc - $r, $xc, $yc - $r);
335
+            $this->arc($xc - $r, $yc - $r * $MyArc, $xc - $r * $MyArc, $yc - $r, $xc, $yc - $r);
336 336
         }
337 337
         $this->out($op);
338 338
     }
@@ -353,12 +353,12 @@  discard block
 block discarded – undo
353 353
         $this->out(
354 354
             sprintf(
355 355
                 '%.2F %.2F %.2F %.2F %.2F %.2F c ',
356
-                $x1*$this->k,
357
-                ($h-$y1)*$this->k,
358
-                $x2*$this->k,
359
-                ($h-$y2)*$this->k,
360
-                $x3*$this->k,
361
-                ($h-$y3)*$this->k
356
+                $x1 * $this->k,
357
+                ($h - $y1) * $this->k,
358
+                $x2 * $this->k,
359
+                ($h - $y2) * $this->k,
360
+                $x3 * $this->k,
361
+                ($h - $y3) * $this->k
362 362
             )
363 363
         );
364 364
     }
@@ -376,26 +376,26 @@  discard block
 block discarded – undo
376 376
     public function dashedRect($x1, $y1, $x2, $y2, $width = 1, $nb = 15)
377 377
     {
378 378
         $this->setLineWidth($width);
379
-        $longueur = abs($x1-$x2);
380
-        $hauteur = abs($y1-$y2);
379
+        $longueur = abs($x1 - $x2);
380
+        $hauteur = abs($y1 - $y2);
381 381
         if ($longueur > $hauteur) {
382
-            $Pointilles = ($longueur/$nb)/2;
382
+            $Pointilles = ($longueur / $nb) / 2;
383 383
         } else {
384
-            $Pointilles = ($hauteur/$nb)/2;
384
+            $Pointilles = ($hauteur / $nb) / 2;
385 385
         }
386
-        for ($i=$x1; $i<=$x2; $i+=$Pointilles+$Pointilles) {
387
-            for ($j=$i; $j<=($i+$Pointilles); $j++) {
388
-                if ($j<=($x2-1)) {
389
-                    $this->line($j, $y1, $j+1, $y1);
390
-                    $this->line($j, $y2, $j+1, $y2);
386
+        for ($i = $x1; $i <= $x2; $i += $Pointilles + $Pointilles) {
387
+            for ($j = $i; $j <= ($i + $Pointilles); $j++) {
388
+                if ($j <= ($x2 - 1)) {
389
+                    $this->line($j, $y1, $j + 1, $y1);
390
+                    $this->line($j, $y2, $j + 1, $y2);
391 391
                 }
392 392
             }
393 393
         }
394
-        for ($i=$y1; $i<=$y2; $i+=$Pointilles+$Pointilles) {
395
-            for ($j=$i; $j<=($i+$Pointilles); $j++) {
396
-                if ($j<=($y2-1)) {
397
-                    $this->line($x1, $j, $x1, $j+1);
398
-                    $this->line($x2, $j, $x2, $j+1);
394
+        for ($i = $y1; $i <= $y2; $i += $Pointilles + $Pointilles) {
395
+            for ($j = $i; $j <= ($i + $Pointilles); $j++) {
396
+                if ($j <= ($y2 - 1)) {
397
+                    $this->line($x1, $j, $x1, $j + 1);
398
+                    $this->line($x2, $j, $x2, $j + 1);
399 399
                 }
400 400
             }
401 401
         }
@@ -417,16 +417,16 @@  discard block
 block discarded – undo
417 417
         $yi = $this->getY();
418 418
         $hrow = $this->fontSize;
419 419
         $textrows = $this->drawRows($w, $hrow, $strText, 0, $align, 0, 0, 0);
420
-        $maxrows = floor($h/$this->fontSize);
420
+        $maxrows = floor($h / $this->fontSize);
421 421
         $rows = min($textrows, $maxrows);
422 422
         $dy = 0;
423 423
         if (strtoupper($valign) == 'M') {
424
-            $dy = ($h-$rows*$this->fontSize)/2;
424
+            $dy = ($h - $rows * $this->fontSize) / 2;
425 425
         }
426 426
         if (strtoupper($valign) == 'B') {
427
-            $dy = $h-$rows*$this->fontSize;
427
+            $dy = $h - $rows * $this->fontSize;
428 428
         }
429
-        $this->setY($yi+$dy);
429
+        $this->setY($yi + $dy);
430 430
         $this->setX($xi);
431 431
         $this->drawRows($w, $hrow, $strText, 0, $align, false, $rows, 1);
432 432
         if ($border) {
@@ -449,17 +449,17 @@  discard block
 block discarded – undo
449 449
      */
450 450
     private function drawRows($w, $h, $txt, $border = 0, $align = 'J', $fill = false, $maxline = 0, $prn = 0)
451 451
     {
452
-        $cw =& $this->currentFont['cw'];
452
+        $cw = & $this->currentFont['cw'];
453 453
         if ($w == 0) {
454
-            $w = $this->w-$this->rMargin-$this->x;
454
+            $w = $this->w - $this->rMargin - $this->x;
455 455
         }
456
-        $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize;
456
+        $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize;
457 457
         $s = str_replace("\r", '', $txt);
458 458
         $nb = strlen($s);
459
-        if ($nb > 0 && $s[$nb-1] == "\n") {
459
+        if ($nb > 0 && $s[$nb - 1] == "\n") {
460 460
             $nb--;
461 461
         }
462
-        $b=0;
462
+        $b = 0;
463 463
         if ($border) {
464 464
             if ($border == 1) {
465 465
                 $border = 'LTRB';
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
                 if (is_int(strpos($border, 'R'))) {
474 474
                     $b2 .= 'R';
475 475
                 }
476
-                $b = is_int(strpos($border, 'T')) ? $b2.'T' : $b2;
476
+                $b = is_int(strpos($border, 'T')) ? $b2 . 'T' : $b2;
477 477
             }
478 478
         }
479 479
         $sep = -1;
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
                     }
493 493
                 }
494 494
                 if ($prn == 1) {
495
-                    $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill);
495
+                    $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
496 496
                 }
497 497
                 $i++;
498 498
                 $sep = -1;
@@ -526,19 +526,19 @@  discard block
 block discarded – undo
526 526
                         }
527 527
                     }
528 528
                     if ($prn == 1) {
529
-                        $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill);
529
+                        $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
530 530
                     }
531 531
                 } else {
532 532
                     if ($align == 'J') {
533
-                        $this->ws = ($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0;
533
+                        $this->ws = ($ns > 1) ? ($wmax - $ls) / 1000 * $this->FontSize / ($ns - 1) : 0;
534 534
                         if ($prn == 1) {
535
-                            $this->out(sprintf('%.3F Tw', $this->ws*$this->k));
535
+                            $this->out(sprintf('%.3F Tw', $this->ws * $this->k));
536 536
                         }
537 537
                     }
538 538
                     if ($prn == 1) {
539
-                        $this->cell($w, $h, substr($s, $j, $sep-$j), $b, 2, $align, $fill);
539
+                        $this->cell($w, $h, substr($s, $j, $sep - $j), $b, 2, $align, $fill);
540 540
                     }
541
-                    $i = $sep+1;
541
+                    $i = $sep + 1;
542 542
                 }
543 543
                 $sep = -1;
544 544
                 $j = $i;
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
             $b .= 'B';
566 566
         }
567 567
         if ($prn == 1) {
568
-            $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill);
568
+            $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
569 569
         }
570 570
         $this->x = $this->lMargin;
571 571
         return $nl;
@@ -595,27 +595,27 @@  discard block
 block discarded – undo
595 595
                 $wordwidth = $this->getStringWidth($word);
596 596
                 if ($wordwidth > $maxwidth) {
597 597
                     // Word is too long, we cut it
598
-                    for ($i=0; $i<strlen($word); $i++) {
598
+                    for ($i = 0; $i < strlen($word); $i++) {
599 599
                         $wordwidth = $this->getStringWidth(substr($word, $i, 1));
600 600
                         if ($width + $wordwidth <= $maxwidth) {
601 601
                             $width += $wordwidth;
602 602
                             $text .= substr($word, $i, 1);
603 603
                         } else {
604 604
                             $width = $wordwidth;
605
-                            $text = rtrim($text)."\n".substr($word, $i, 1);
605
+                            $text = rtrim($text) . "\n" . substr($word, $i, 1);
606 606
                             $count++;
607 607
                         }
608 608
                     }
609 609
                 } elseif ($width + $wordwidth <= $maxwidth) {
610 610
                     $width += $wordwidth + $space;
611
-                    $text .= $word.' ';
611
+                    $text .= $word . ' ';
612 612
                 } else {
613 613
                     $width = $wordwidth + $space;
614
-                    $text = rtrim($text)."\n".$word.' ';
614
+                    $text = rtrim($text) . "\n" . $word . ' ';
615 615
                     $count++;
616 616
                 }
617 617
             }
618
-            $text = rtrim($text)."\n";
618
+            $text = rtrim($text) . "\n";
619 619
             $count++;
620 620
         }
621 621
         $text = rtrim($text);
@@ -648,21 +648,21 @@  discard block
 block discarded – undo
648 648
         $scale = false,
649 649
         $force = true
650 650
     ) {
651
-        $str_width=$this->getStringWidth($txt);
651
+        $str_width = $this->getStringWidth($txt);
652 652
         if ($w == 0) {
653
-            $w = $this->w-$this->rMargin-$this->x;
653
+            $w = $this->w - $this->rMargin - $this->x;
654 654
         }
655
-        $ratio = ($w-$this->cMargin*2)/$str_width;
655
+        $ratio = ($w - $this->cMargin * 2) / $str_width;
656 656
         $fit = ($ratio < 1 || ($ratio > 1 && $force));
657 657
         if ($fit) {
658 658
             if ($scale) {
659 659
                 //Calcula a escala horizontal
660
-                $horiz_scale = $ratio*100.0;
660
+                $horiz_scale = $ratio * 100.0;
661 661
                 //Ajusta a escala horizontal
662 662
                 $this->out(sprintf('BT %.2F Tz ET', $horiz_scale));
663 663
             } else {
664 664
                 //Calcula o espaçamento de caracteres em pontos
665
-                $char_space = ($w-$this->cMargin*2-$str_width)/max($this->_MBGetStringLength($txt)-1, 1)*$this->k;
665
+                $char_space = ($w - $this->cMargin * 2 - $str_width) / max($this->_MBGetStringLength($txt) - 1, 1) * $this->k;
666 666
                 //Ajusta o espaçamento de caracteres
667 667
                 $this->out(sprintf('BT %.2F Tc ET', $char_space));
668 668
             }
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
         $this->cell($w, $h, $txt, $border, $ln, $align, $fill, $link);
674 674
         //Reseta o espaçamento de caracteres e a escala horizontal
675 675
         if ($fit) {
676
-            $this->out('BT '.($scale ? '100 Tz' : '0 Tc').' ET');
676
+            $this->out('BT ' . ($scale ? '100 Tz' : '0 Tc') . ' ET');
677 677
         }
678 678
     }
679 679
 
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
             $len = 0;
774 774
             $nbbytes = strlen($s);
775 775
             for ($i = 0; $i < $nbbytes; $i++) {
776
-                if (ord($s[$i])<128) {
776
+                if (ord($s[$i]) < 128) {
777 777
                     $len++;
778 778
                 } else {
779 779
                     $len++;
@@ -800,11 +800,11 @@  discard block
 block discarded – undo
800 800
     {
801 801
         $this->setDrawColor(110);
802 802
         $this->setLineWidth($h);
803
-        $wDash = ($w/$n)/2; // comprimento dos traços
804
-        for ($i=$x; $i<=$x+$w; $i += $wDash+$wDash) {
805
-            for ($j=$i; $j<= ($i+$wDash); $j++) {
806
-                if ($j <= ($x+$w-1)) {
807
-                    $this->line($j, $y, $j+1, $y);
803
+        $wDash = ($w / $n) / 2; // comprimento dos traços
804
+        for ($i = $x; $i <= $x + $w; $i += $wDash + $wDash) {
805
+            for ($j = $i; $j <= ($i + $wDash); $j++) {
806
+                if ($j <= ($x + $w - 1)) {
807
+                    $this->line($j, $y, $j + 1, $y);
808 808
                 }
809 809
             }
810 810
         }
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
             $y = $aux;
832 832
         }
833 833
         while ($y < $yfinal && $n > 0) {
834
-            $this->line($x, $y, $x, $y+1);
834
+            $this->line($x, $y, $x, $y + 1);
835 835
             $y += 3;
836 836
             $n--;
837 837
         }
Please login to merge, or discard this patch.
src/Legacy/FilesFolders.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 class FilesFolders
19 19
 {
20 20
     
21
-    protected static $ambientes = array('homologacao','producao');
21
+    protected static $ambientes = array('homologacao', 'producao');
22 22
     protected static $subdirs = array(
23 23
         'entradas',
24 24
         'assinadas',
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
             . DIRECTORY_SEPARATOR
70 70
             . $subdir;
71 71
         
72
-        if (! is_dir($path)) {
72
+        if (!is_dir($path)) {
73 73
             $msg = "Não existe o diretorio $path !";
74 74
             throw new RuntimeException($msg);
75 75
         }
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
         //monta a arvore de diretórios necessária e estabelece permissões de acesso
89 89
         self::createFolder($dirPath);
90 90
         foreach (self::$ambientes as $ambiente) {
91
-            $folder = $dirPath.DIRECTORY_SEPARATOR.$ambiente;
91
+            $folder = $dirPath . DIRECTORY_SEPARATOR . $ambiente;
92 92
             self::createFolder($folder);
93 93
             foreach (self::$subdirs as $subdir) {
94
-                $folder = $dirPath.DIRECTORY_SEPARATOR.$ambiente.DIRECTORY_SEPARATOR.$subdir;
94
+                $folder = $dirPath . DIRECTORY_SEPARATOR . $ambiente . DIRECTORY_SEPARATOR . $subdir;
95 95
                 self::createFolder($folder);
96 96
             }
97 97
         }
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
      */
106 106
     public static function createFolder($folder = '')
107 107
     {
108
-        if (! is_dir($folder)) {
109
-            if (! mkdir($folder, 0777, true)) {
108
+        if (!is_dir($folder)) {
109
+            if (!mkdir($folder, 0777, true)) {
110 110
                 throw new RuntimeException(
111 111
                     "Não foi possivel criar o diretorio $folder. Verifique as permissões"
112 112
                 );
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
     public static function saveFile($path = '', $filename = '', $content = '')
125 125
     {
126 126
         self::createFolder($path);
127
-        $filePath = $path.DIRECTORY_SEPARATOR.$filename;
128
-        if (! file_put_contents($filePath, $content)) {
127
+        $filePath = $path . DIRECTORY_SEPARATOR . $filename;
128
+        if (!file_put_contents($filePath, $content)) {
129 129
             return false;
130 130
         }
131
-        if (! chmod($filePath, 0777)) {
131
+        if (!chmod($filePath, 0777)) {
132 132
             return false;
133 133
         }
134 134
         return true;
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
                 "É necessário passar os parametros diretório e filtro!!!"
151 151
             );
152 152
         }
153
-        if (! is_dir($folder)) {
153
+        if (!is_dir($folder)) {
154 154
             throw new InvalidArgumentException(
155 155
                 "O diretório não existe $folder !!!"
156 156
             );
@@ -158,15 +158,15 @@  discard block
 block discarded – undo
158 158
         $aList = array();
159 159
         $search = $folder;
160 160
         if (substr($folder, -1) == DIRECTORY_SEPARATOR) {
161
-            $search = substr($folder, 0, strlen($folder)-1);
161
+            $search = substr($folder, 0, strlen($folder) - 1);
162 162
         }
163
-        $searchmatch = $search.DIRECTORY_SEPARATOR.$fileMatch;
163
+        $searchmatch = $search . DIRECTORY_SEPARATOR . $fileMatch;
164 164
         $aGlob = glob($searchmatch);
165 165
         $aList = $aGlob;
166
-        if (! $retpath && ! empty($aGlob)) {
166
+        if (!$retpath && !empty($aGlob)) {
167 167
             $aList = array();
168 168
             foreach ($aGlob as $pathFile) {
169
-                $aList[] = str_replace($search.DIRECTORY_SEPARATOR, '', $pathFile);
169
+                $aList[] = str_replace($search . DIRECTORY_SEPARATOR, '', $pathFile);
170 170
             }
171 171
         }
172 172
         return $aList;
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         $comentDir = 'O diret&oacute;rio N&Atilde;O EXISTE';
188 188
         $corDir = $cRed;
189 189
         if (is_dir($path)) {
190
-            $filen = $path.DIRECTORY_SEPARATOR.'teste.txt';
190
+            $filen = $path . DIRECTORY_SEPARATOR . 'teste.txt';
191 191
             $comentDir = ' Sem permiss&atilde;o !!';
192 192
             if (file_put_contents($filen, "teste\r\n")) {
193 193
                 $corDir = $cGreen;
@@ -213,19 +213,19 @@  discard block
 block discarded – undo
213 213
      */
214 214
     public static function removeFolder($dirPath)
215 215
     {
216
-        $files = array_diff(scandir($dirPath), array('.','..'));
216
+        $files = array_diff(scandir($dirPath), array('.', '..'));
217 217
         foreach ($files as $file) {
218 218
             if (is_dir("$dirPath/$file")) {
219 219
                 self::removeFolder("$dirPath/$file");
220 220
             } else {
221
-                if (! unlink("$dirPath/$file")) {
221
+                if (!unlink("$dirPath/$file")) {
222 222
                     throw new RuntimeException(
223 223
                         "Falha! sem permissão de exclusão do arquivo $dirPath/$file"
224 224
                     );
225 225
                 }
226 226
             }
227 227
         }
228
-        if (! rmdir($dirPath)) {
228
+        if (!rmdir($dirPath)) {
229 229
             $msg = "Falha! sem permissão de exclusão do diretório $dirPath";
230 230
             throw new RuntimeException($msg);
231 231
         }
@@ -245,11 +245,11 @@  discard block
 block discarded – undo
245 245
             $msg = "Um caminho para o arquivo deve ser passado!!";
246 246
             throw new InvalidArgumentException($msg);
247 247
         }
248
-        if (! is_file($pathFile)) {
248
+        if (!is_file($pathFile)) {
249 249
             $msg = "O arquivo indicado não foi localizado!! $pathFile";
250 250
             throw new InvalidArgumentException($msg);
251 251
         }
252
-        if (! is_readable($pathFile)) {
252
+        if (!is_readable($pathFile)) {
253 253
             $msg = "O arquivo indicado não pode ser lido. Permissões!! $pathFile";
254 254
             throw new RuntimeException($msg);
255 255
         }
Please login to merge, or discard this patch.
src/Legacy/Common.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
         $tamanho = strlen($numero);
117 117
         $soma = 0;
118 118
         $mult = 2;
119
-        for ($i = $tamanho-1; $i >= 0; $i--) {
119
+        for ($i = $tamanho - 1; $i >= 0; $i--) {
120 120
             $digito = (int) $numero[$i];
121 121
             $r = $digito * $mult;
122 122
             $soma += $r;
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
             $atDH = explode(':', $inter[0]);
170 170
             $timestampDH = mktime($atDH[0], $atDH[1], $atDH[2], $adDH[1], $adDH[2], $adDH[0]);
171 171
         } else {
172
-            $timestampDH = mktime($month = $adDH[1], $day =  $adDH[2], $year = $adDH[0]);
172
+            $timestampDH = mktime($month = $adDH[1], $day = $adDH[2], $year = $adDH[0]);
173 173
         }
174 174
         return $timestampDH;
175 175
     }
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
         }
201 201
         //contar o numero de cerquilhas da mascara
202 202
         $aMask = str_split($mascara);
203
-        $z=0;
204
-        $flag=false;
203
+        $z = 0;
204
+        $flag = false;
205 205
         foreach ($aMask as $letra) {
206 206
             if ($letra == '#') {
207 207
                 $z++;
@@ -209,20 +209,20 @@  discard block
 block discarded – undo
209 209
         }
210 210
         if ($z > $tCampo) {
211 211
             //o campo é menor que esperado
212
-            $flag=true;
212
+            $flag = true;
213 213
         }
214 214
         //cria uma variável grande o suficiente para conter os dados
215 215
         $sRetorno = '';
216
-        $sRetorno = str_pad($sRetorno, $tCampo+$tMask, " ", STR_PAD_LEFT);
216
+        $sRetorno = str_pad($sRetorno, $tCampo + $tMask, " ", STR_PAD_LEFT);
217 217
         //pega o tamanho da string de retorno
218 218
         $tRetorno = strlen($sRetorno);
219 219
         //se houve entrada de dados
220
-        if ($sLimpo != '' && $mascara !='') {
220
+        if ($sLimpo != '' && $mascara != '') {
221 221
             //inicia com a posição do ultimo digito da mascara
222 222
             $x = $tMask;
223 223
             $y = $tCampo;
224 224
             $cI = 0;
225
-            for ($i = $tMaior-1; $i >= 0; $i--) {
225
+            for ($i = $tMaior - 1; $i >= 0; $i--) {
226 226
                 if ($cI < $z) {
227 227
                     // e o digito da mascara é # trocar pelo digito do campo
228 228
                     // se o inicio da string da mascara for atingido antes de terminar
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
                     }
235 235
                     //se o fim do campo for atingido antes do fim da mascara
236 236
                     //verificar se é ( se não for não use
237
-                    if ($digMask=='#') {
237
+                    if ($digMask == '#') {
238 238
                         $cI++;
239 239
                         if ($y > 0) {
240 240
                             $sRetorno[--$tRetorno] = $sLimpo[--$y];
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
                         if ($y > 0) {
246 246
                             $sRetorno[--$tRetorno] = $mascara[$x];
247 247
                         } else {
248
-                            if ($mascara[$x] =='(') {
248
+                            if ($mascara[$x] == '(') {
249 249
                                 $sRetorno[--$tRetorno] = $mascara[$x];
250 250
                             }
251 251
                         }
@@ -273,11 +273,11 @@  discard block
 block discarded – undo
273 273
      * @param  array  $aFont
274 274
      * @return number numero de linhas
275 275
      */
276
-    protected function pGetNumLines($text, $width, $aFont = array('font'=>'Times','size'=>8,'style'=>''))
276
+    protected function pGetNumLines($text, $width, $aFont = array('font'=>'Times', 'size'=>8, 'style'=>''))
277 277
     {
278 278
         $text = trim($text);
279 279
         $this->pdf->SetFont($aFont['font'], $aFont['style'], $aFont['size']);
280
-        $n = $this->pdf->WordWrap($text, $width-0.2);
280
+        $n = $this->pdf->WordWrap($text, $width - 0.2);
281 281
         return $n;
282 282
     }
283 283
 
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
         $w,
315 315
         $h,
316 316
         $text = '',
317
-        $aFont = array('font'=>'Times','size'=>8,'style'=>''),
317
+        $aFont = array('font'=>'Times', 'size'=>8, 'style'=>''),
318 318
         $vAlign = 'T',
319 319
         $hAlign = 'L',
320 320
         $border = 1,
@@ -361,15 +361,15 @@  discard block
 block discarded – undo
361 361
         //verificar o alinhamento vertical
362 362
         if ($vAlign == 'T') {
363 363
             //alinhado ao topo
364
-            $y1 = $y+$incY;
364
+            $y1 = $y + $incY;
365 365
         }
366 366
         if ($vAlign == 'C') {
367 367
             //alinhado ao centro
368
-            $y1 = $y + $incY + (($h-$altText)/2);
368
+            $y1 = $y + $incY + (($h - $altText) / 2);
369 369
         }
370 370
         if ($vAlign == 'B') {
371 371
             //alinhado a base
372
-            $y1 = ($y + $h)-0.5;
372
+            $y1 = ($y + $h) - 0.5;
373 373
         }
374 374
         //para cada linha
375 375
         foreach ($lines as $line) {
@@ -386,17 +386,17 @@  discard block
 block discarded – undo
386 386
             }
387 387
             //ajustar ao alinhamento horizontal
388 388
             if ($hAlign == 'L') {
389
-                $x1 = $x+0.5;
389
+                $x1 = $x + 0.5;
390 390
             }
391 391
             if ($hAlign == 'C') {
392
-                $x1 = $x + (($w - $comp)/2);
392
+                $x1 = $x + (($w - $comp) / 2);
393 393
             }
394 394
             if ($hAlign == 'R') {
395
-                $x1 = $x + $w - ($comp+0.5);
395
+                $x1 = $x + $w - ($comp + 0.5);
396 396
             }
397 397
             //escrever o texto
398 398
             if ($vOffSet > 0) {
399
-                if ($y1 > ($oldY+$vOffSet)) {
399
+                if ($y1 > ($oldY + $vOffSet)) {
400 400
                     if (!$resetou) {
401 401
                         $y1 = $oldY;
402 402
                         $resetou = true;
@@ -408,12 +408,12 @@  discard block
 block discarded – undo
408 408
             }
409 409
             //incrementar para escrever o proximo
410 410
             $y1 += $incY;
411
-            if (($hmax > 0) && ($y1 > ($y+($hmax-1)))) {
411
+            if (($hmax > 0) && ($y1 > ($y + ($hmax - 1)))) {
412 412
                 $temObs = true;
413 413
                 break;
414 414
             }
415 415
         }
416
-        return ($y1-$y)-$incY;
416
+        return ($y1 - $y) - $incY;
417 417
     } // fim função __textBox
418 418
 
419 419
     /**
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
         $w,
450 450
         $h,
451 451
         $text = '',
452
-        $aFont = array('font'=>'Times','size'=>8,'style'=>''),
452
+        $aFont = array('font'=>'Times', 'size'=>8, 'style'=>''),
453 453
         $vAlign = 'T',
454 454
         $hAlign = 'L',
455 455
         $border = 1,
@@ -498,15 +498,15 @@  discard block
 block discarded – undo
498 498
         //verificar o alinhamento vertical
499 499
         if ($vAlign == 'T') {
500 500
             //alinhado ao topo
501
-            $y1 = $y+$incY;
501
+            $y1 = $y + $incY;
502 502
         }
503 503
         if ($vAlign == 'C') {
504 504
             //alinhado ao centro
505
-            $y1 = $y + $incY + (($h-$altText)/2);
505
+            $y1 = $y + $incY + (($h - $altText) / 2);
506 506
         }
507 507
         if ($vAlign == 'B') {
508 508
             //alinhado a base
509
-            $y1 = ($y + $h)-0.5;
509
+            $y1 = ($y + $h) - 0.5;
510 510
         }
511 511
         //para cada linha
512 512
         foreach ($lines as $line) {
@@ -523,17 +523,17 @@  discard block
 block discarded – undo
523 523
             }
524 524
             //ajustar ao alinhamento horizontal
525 525
             if ($hAlign == 'L') {
526
-                $x1 = $x+0.5;
526
+                $x1 = $x + 0.5;
527 527
             }
528 528
             if ($hAlign == 'C') {
529
-                $x1 = $x + (($w - $comp)/2);
529
+                $x1 = $x + (($w - $comp) / 2);
530 530
             }
531 531
             if ($hAlign == 'R') {
532
-                $x1 = $x + $w - ($comp+0.5);
532
+                $x1 = $x + $w - ($comp + 0.5);
533 533
             }
534 534
             //escrever o texto
535 535
             if ($vOffSet > 0) {
536
-                if ($y1 > ($oldY+$vOffSet)) {
536
+                if ($y1 > ($oldY + $vOffSet)) {
537 537
                     if (!$resetou) {
538 538
                         $y1 = $oldY;
539 539
                         $resetou = true;
@@ -545,13 +545,13 @@  discard block
 block discarded – undo
545 545
             }
546 546
             //incrementar para escrever o proximo
547 547
             $y1 += $incY;
548
-            if (($hmax > 0) && ($y1 > ($y+($hmax-1)))) {
548
+            if (($hmax > 0) && ($y1 > ($y + ($hmax - 1)))) {
549 549
                 $temObs = true;
550 550
                 break;
551 551
             }
552 552
         }
553 553
         //Zerando rotação
554 554
         $this->pdf->Rotate(0, $x, $y);
555
-        return ($y1-$y)-$incY;
555
+        return ($y1 - $y) - $incY;
556 556
     }
557 557
 }
Please login to merge, or discard this patch.
src/Legacy/FPDF/font/courier.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-for ($i=0; $i<=255; $i++) {
3
-    $fpdf_charwidths['courier'][chr($i)]=600;
2
+for ($i = 0; $i <= 255; $i++) {
3
+    $fpdf_charwidths['courier'][chr($i)] = 600;
4 4
 }
5
-$fpdf_charwidths['courierB']=$fpdf_charwidths['courier'];
6
-$fpdf_charwidths['courierI']=$fpdf_charwidths['courier'];
7
-$fpdf_charwidths['courierBI']=$fpdf_charwidths['courier'];
5
+$fpdf_charwidths['courierB'] = $fpdf_charwidths['courier'];
6
+$fpdf_charwidths['courierI'] = $fpdf_charwidths['courier'];
7
+$fpdf_charwidths['courierBI'] = $fpdf_charwidths['courier'];
Please login to merge, or discard this patch.
src/Legacy/FPDF/font/makefont/makefont.php 1 patch
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -10,23 +10,23 @@  discard block
 block discarded – undo
10 10
 function readMap($enc)
11 11
 {
12 12
     //Read a map file
13
-    $file = dirname(__FILE__).'/'.strtolower($enc).'.map';
13
+    $file = dirname(__FILE__) . '/' . strtolower($enc) . '.map';
14 14
     $a = file($file);
15 15
     if (empty($a)) {
16
-        die('<b>Error:</b> encoding not found: '.$enc);
16
+        die('<b>Error:</b> encoding not found: ' . $enc);
17 17
     }
18 18
     $cc2gn = array();
19 19
     foreach ($a as $l) {
20
-        if ($l[0]=='!') {
20
+        if ($l[0] == '!') {
21 21
             $e = preg_split('/[ \\t]+/', rtrim($l));
22 22
             $cc = hexdec(substr($e[0], 1));
23 23
             $gn = $e[2];
24 24
             $cc2gn[$cc] = $gn;
25 25
         }
26 26
     }
27
-    for ($i=0; $i<=255; $i++) {
27
+    for ($i = 0; $i <= 255; $i++) {
28 28
         if (!isset($cc2gn[$i])) {
29
-            $cc2gn[$i]='.notdef';
29
+            $cc2gn[$i] = '.notdef';
30 30
         }
31 31
     }
32 32
     return $cc2gn;
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
     ];
79 79
     foreach ($a as $l) {
80 80
         $e = explode(' ', rtrim($l));
81
-        if (count($e)<2) {
81
+        if (count($e) < 2) {
82 82
             continue;
83 83
         }
84 84
         $code = $e[0];
85 85
         $param = $e[1];
86 86
         if ($code == 'C') {
87 87
             //Character metrics
88
-            $cc = (int)$e[1];
88
+            $cc = (int) $e[1];
89 89
             $w = $e[4];
90 90
             $gn = $e[7];
91 91
             if (substr($gn, -4) == '20AC') {
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
                 //Fix incorrect glyph name
96 96
                 foreach ($map as $c => $n) {
97 97
                     if ($n == $fix[$gn]) {
98
-                        $map[$c]=$gn;
98
+                        $map[$c] = $gn;
99 99
                     }
100 100
                 }
101 101
             }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
             } else {
106 106
                 $widths[$gn] = $w;
107 107
                 if ($gn == 'X') {
108
-                    $fm['CapXHeight']=$e[13];
108
+                    $fm['CapXHeight'] = $e[13];
109 109
                 }
110 110
             }
111 111
             if ($gn == '.notdef') {
@@ -116,23 +116,23 @@  discard block
 block discarded – undo
116 116
         } elseif ($code == 'Weight') {
117 117
             $fm['Weight'] = $param;
118 118
         } elseif ($code == 'ItalicAngle') {
119
-            $fm['ItalicAngle'] = (double)$param;
119
+            $fm['ItalicAngle'] = (double) $param;
120 120
         } elseif ($code == 'Ascender') {
121
-            $fm['Ascender'] = (int)$param;
121
+            $fm['Ascender'] = (int) $param;
122 122
         } elseif ($code == 'Descender') {
123
-            $fm['Descender'] = (int)$param;
123
+            $fm['Descender'] = (int) $param;
124 124
         } elseif ($code == 'UnderlineThickness') {
125
-            $fm['UnderlineThickness'] = (int)$param;
125
+            $fm['UnderlineThickness'] = (int) $param;
126 126
         } elseif ($code == 'UnderlinePosition') {
127
-            $fm['UnderlinePosition'] = (int)$param;
127
+            $fm['UnderlinePosition'] = (int) $param;
128 128
         } elseif ($code == 'IsFixedPitch') {
129 129
             $fm['IsFixedPitch'] = ($param == 'true');
130 130
         } elseif ($code == 'FontBBox') {
131 131
             $fm['FontBBox'] = array($e[1], $e[2], $e[3], $e[4]);
132 132
         } elseif ($code == 'CapHeight') {
133
-            $fm['CapHeight'] = (int)$param;
133
+            $fm['CapHeight'] = (int) $param;
134 134
         } elseif ($code == 'StdVW') {
135
-            $fm['StdVW'] = (int)$param;
135
+            $fm['StdVW'] = (int) $param;
136 136
         }
137 137
     }
138 138
     if (!isset($fm['FontName'])) {
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
             $widths['Delta'] = $widths['increment'];
147 147
         }
148 148
         //Order widths according to map
149
-        for ($i=0; $i<=255; $i++) {
149
+        for ($i = 0; $i <= 255; $i++) {
150 150
             if (!isset($widths[$map[$i]])) {
151
-                echo '<b>Warning:</b> character '.$map[$i].' is missing<br>';
151
+                echo '<b>Warning:</b> character ' . $map[$i] . ' is missing<br>';
152 152
                 $widths[$i] = $widths['.notdef'];
153 153
             } else {
154 154
                 $widths[$i] = $widths[$map[$i]];
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
 function makeFontDescriptor($fm, $symbolic)
163 163
 {
164 164
     //Ascent
165
-    $asc=(isset($fm['Ascender']) ? $fm['Ascender'] : 1000);
166
-    $fd = "array('Ascent'=>".$asc;
165
+    $asc = (isset($fm['Ascender']) ? $fm['Ascender'] : 1000);
166
+    $fd = "array('Ascent'=>" . $asc;
167 167
     //Descent
168 168
     $desc = (isset($fm['Descender']) ? $fm['Descender'] : -200);
169
-    $fd .= ",'Descent'=>".$desc;
169
+    $fd .= ",'Descent'=>" . $desc;
170 170
     //CapHeight
171 171
     if (isset($fm['CapHeight'])) {
172 172
         $ch = $fm['CapHeight'];
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
     } else {
176 176
         $ch = $asc;
177 177
     }
178
-    $fd .= ",'CapHeight'=>".$ch;
178
+    $fd .= ",'CapHeight'=>" . $ch;
179 179
     //Flags
180 180
     $flags = 0;
181 181
     if (isset($fm['IsFixedPitch']) && $fm['IsFixedPitch']) {
@@ -185,22 +185,22 @@  discard block
 block discarded – undo
185 185
         $flags += 1 << 2;
186 186
     }
187 187
     if (!$symbolic) {
188
-        $flags += 1<< 5;
188
+        $flags += 1 << 5;
189 189
     }
190
-    if (isset($fm['ItalicAngle']) && $fm['ItalicAngle']!=0) {
190
+    if (isset($fm['ItalicAngle']) && $fm['ItalicAngle'] != 0) {
191 191
         $flags += 1 << 6;
192 192
     }
193
-    $fd.=",'Flags'=>".$flags;
193
+    $fd .= ",'Flags'=>" . $flags;
194 194
     //FontBBox
195 195
     if (isset($fm['FontBBox'])) {
196 196
         $fbb = $fm['FontBBox'];
197 197
     } else {
198
-        $fbb = array(0,$desc-100,1000,$asc+100);
198
+        $fbb = array(0, $desc - 100, 1000, $asc + 100);
199 199
     }
200
-    $fd .= ",'FontBBox'=>'[".$fbb[0].' '.$fbb[1].' '.$fbb[2].' '.$fbb[3]."]'";
200
+    $fd .= ",'FontBBox'=>'[" . $fbb[0] . ' ' . $fbb[1] . ' ' . $fbb[2] . ' ' . $fbb[3] . "]'";
201 201
     //ItalicAngle
202 202
     $ia = (isset($fm['ItalicAngle']) ? $fm['ItalicAngle'] : 0);
203
-    $fd .= ",'ItalicAngle'=>".$ia;
203
+    $fd .= ",'ItalicAngle'=>" . $ia;
204 204
     //StemV
205 205
     if (isset($fm['StdVW'])) {
206 206
         $stemv = $fm['StdVW'];
@@ -209,10 +209,10 @@  discard block
 block discarded – undo
209 209
     } else {
210 210
         $stemv = 70;
211 211
     }
212
-    $fd .= ",'StemV'=>".$stemv;
212
+    $fd .= ",'StemV'=>" . $stemv;
213 213
     //MissingWidth
214 214
     if (isset($fm['MissingWidth'])) {
215
-        $fd .= ",'MissingWidth'=>".$fm['MissingWidth'];
215
+        $fd .= ",'MissingWidth'=>" . $fm['MissingWidth'];
216 216
     }
217 217
     $fd .= ')';
218 218
     return $fd;
@@ -223,21 +223,21 @@  discard block
 block discarded – undo
223 223
     //Make character width array
224 224
     $s = "array(\n\t";
225 225
     $cw = $fm['Widths'];
226
-    for ($i=0; $i<=255; $i++) {
226
+    for ($i = 0; $i <= 255; $i++) {
227 227
         if (chr($i) == "'") {
228 228
             $s .= "'\\''";
229 229
         } elseif (chr($i) == "\\") {
230 230
             $s .= "'\\\\'";
231 231
         } elseif ($i >= 32 && $i <= 126) {
232
-            $s .= "'".chr($i)."'";
232
+            $s .= "'" . chr($i) . "'";
233 233
         } else {
234 234
             $s .= "chr($i)";
235 235
         }
236
-        $s .= '=>'.$fm['Widths'][$i];
236
+        $s .= '=>' . $fm['Widths'][$i];
237 237
         if ($i < 255) {
238 238
             $s .= ',';
239 239
         }
240
-        if (($i+1)%22==0) {
240
+        if (($i + 1) % 22 == 0) {
241 241
             $s .= "\n\t";
242 242
         }
243 243
     }
@@ -251,13 +251,13 @@  discard block
 block discarded – undo
251 251
     $ref = readMap('cp1252');
252 252
     $s = '';
253 253
     $last = 0;
254
-    for ($i=32; $i<=255; $i++) {
255
-        if ($map[$i]!=$ref[$i]) {
256
-            if ($i!=$last+1) {
257
-                $s .= $i.' ';
254
+    for ($i = 32; $i <= 255; $i++) {
255
+        if ($map[$i] != $ref[$i]) {
256
+            if ($i != $last + 1) {
257
+                $s .= $i . ' ';
258 258
             }
259 259
             $last = $i;
260
-            $s .= '/'.$map[$i].' ';
260
+            $s .= '/' . $map[$i] . ' ';
261 261
         }
262 262
     }
263 263
     return rtrim($s);
@@ -265,9 +265,9 @@  discard block
 block discarded – undo
265 265
 
266 266
 function saveToFile($file, $s, $mode)
267 267
 {
268
-    $f = fopen($file, 'w'.$mode);
268
+    $f = fopen($file, 'w' . $mode);
269 269
     if (!$f) {
270
-        die('Can\'t write to file '.$file);
270
+        die('Can\'t write to file ' . $file);
271 271
     }
272 272
     fwrite($f, $s, strlen($s));
273 273
     fclose($f);
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
     //Check if font license allows embedding
291 291
     $f = fopen($file, 'rb');
292 292
     if (!$f) {
293
-        die('<b>Error:</b> Can\'t open '.$file);
293
+        die('<b>Error:</b> Can\'t open ' . $file);
294 294
     }
295 295
     //Extract number of tables
296 296
     fseek($f, 4, SEEK_CUR);
@@ -298,8 +298,8 @@  discard block
 block discarded – undo
298 298
     fseek($f, 6, SEEK_CUR);
299 299
     //Seek OS/2 table
300 300
     $found = false;
301
-    for ($i=0; $i<$nb; $i++) {
302
-        if (fread($f, 4)=='OS/2') {
301
+    for ($i = 0; $i < $nb; $i++) {
302
+        if (fread($f, 4) == 'OS/2') {
303 303
             $found = true;
304 304
             break;
305 305
         }
@@ -315,9 +315,9 @@  discard block
 block discarded – undo
315 315
     //Extract fsType flags
316 316
     fseek($f, 8, SEEK_CUR);
317 317
     $fsType = readShort($f);
318
-    $rl = ($fsType & 0x02)!=0;
319
-    $pp = ($fsType & 0x04)!=0;
320
-    $e = ($fsType & 0x08)!=0;
318
+    $rl = ($fsType & 0x02) != 0;
319
+    $pp = ($fsType & 0x04) != 0;
320
+    $e = ($fsType & 0x08) != 0;
321 321
     fclose($f);
322 322
     if ($rl && !$pp && !$e) {
323 323
         echo '<b>Warning:</b> font license does not allow embedding';
@@ -341,71 +341,71 @@  discard block
 block discarded – undo
341 341
     if ($enc) {
342 342
         $map = readMap($enc);
343 343
         foreach ($patch as $cc => $gn) {
344
-            $map[$cc]=$gn;
344
+            $map[$cc] = $gn;
345 345
         }
346 346
     } else {
347
-        $map=array();
347
+        $map = array();
348 348
     }
349 349
     if (!file_exists($afmfile)) {
350
-        die('<b>Error:</b> AFM file not found: '.$afmfile);
350
+        die('<b>Error:</b> AFM file not found: ' . $afmfile);
351 351
     }
352 352
     $fm = readAFM($afmfile, $map);
353 353
     if ($enc) {
354 354
         $diff = makeFontEncoding($map);
355 355
     } else {
356
-        $diff='';
356
+        $diff = '';
357 357
     }
358 358
     $fd = makeFontDescriptor($fm, empty($map));
359 359
     //Find font type
360 360
     if ($fontfile) {
361 361
         $ext = strtolower(substr($fontfile, -3));
362 362
         if ($ext == 'ttf') {
363
-            $type='TrueType';
363
+            $type = 'TrueType';
364 364
         } elseif ($ext == 'pfb') {
365 365
             $type = 'Type1';
366 366
         } else {
367
-            die('<b>Error:</b> unrecognized font file extension: '.$ext);
367
+            die('<b>Error:</b> unrecognized font file extension: ' . $ext);
368 368
         }
369 369
     } else {
370
-        if ($type!='TrueType' && $type!='Type1') {
371
-            die('<b>Error:</b> incorrect font type: '.$type);
370
+        if ($type != 'TrueType' && $type != 'Type1') {
371
+            die('<b>Error:</b> incorrect font type: ' . $type);
372 372
         }
373 373
     }
374 374
     //Start generation
375
-    $s = '<?php'."\n";
376
-    $s .= '$type=\''.$type."';\n";
377
-    $s .= '$name=\''.$fm['FontName']."';\n";
378
-    $s .= '$desc='.$fd.";\n";
375
+    $s = '<?php' . "\n";
376
+    $s .= '$type=\'' . $type . "';\n";
377
+    $s .= '$name=\'' . $fm['FontName'] . "';\n";
378
+    $s .= '$desc=' . $fd . ";\n";
379 379
     if (!isset($fm['UnderlinePosition'])) {
380 380
         $fm['UnderlinePosition'] = -100;
381 381
     }
382 382
     if (!isset($fm['UnderlineThickness'])) {
383 383
         $fm['UnderlineThickness'] = 50;
384 384
     }
385
-    $s .= '$up='.$fm['UnderlinePosition'].";\n";
386
-    $s .= '$ut='.$fm['UnderlineThickness'].";\n";
385
+    $s .= '$up=' . $fm['UnderlinePosition'] . ";\n";
386
+    $s .= '$ut=' . $fm['UnderlineThickness'] . ";\n";
387 387
     $w = makeWidthArray($fm);
388
-    $s .= '$cw='.$w.";\n";
389
-    $s .= '$enc=\''.$enc."';\n";
390
-    $s.= '$diff=\''.$diff."';\n";
388
+    $s .= '$cw=' . $w . ";\n";
389
+    $s .= '$enc=\'' . $enc . "';\n";
390
+    $s .= '$diff=\'' . $diff . "';\n";
391 391
     $basename = substr(basename($afmfile), 0, -4);
392 392
     if ($fontfile) {
393 393
         //Embedded font
394 394
         if (!file_exists($fontfile)) {
395
-            die('<b>Error:</b> font file not found: '.$fontfile);
395
+            die('<b>Error:</b> font file not found: ' . $fontfile);
396 396
         }
397
-        if ($type=='TrueType') {
397
+        if ($type == 'TrueType') {
398 398
             checkTTF($fontfile);
399 399
         }
400 400
         $f = fopen($fontfile, 'rb');
401 401
         if (!$f) {
402
-            die('<b>Error:</b> Can\'t open '.$fontfile);
402
+            die('<b>Error:</b> Can\'t open ' . $fontfile);
403 403
         }
404 404
         $file = fread($f, filesize($fontfile));
405 405
         fclose($f);
406 406
         if ($type == 'Type1') {
407 407
             //Find first two sections and discard third one
408
-            $header = (ord($file[0])==128);
408
+            $header = (ord($file[0]) == 128);
409 409
             if ($header) {
410 410
                 //Strip first binary header
411 411
                 $file = substr($file, 6);
@@ -414,38 +414,38 @@  discard block
 block discarded – undo
414 414
             if (!$pos) {
415 415
                 die('<b>Error:</b> font file does not seem to be valid Type1');
416 416
             }
417
-            $size1 = $pos+6;
418
-            if ($header && ord($file[$size1])==128) {
417
+            $size1 = $pos + 6;
418
+            if ($header && ord($file[$size1]) == 128) {
419 419
                 //Strip second binary header
420
-                $file = substr($file, 0, $size1).substr($file, $size1+6);
420
+                $file = substr($file, 0, $size1) . substr($file, $size1 + 6);
421 421
             }
422 422
             $pos = strpos($file, '00000000');
423 423
             if (!$pos) {
424 424
                 die('<b>Error:</b> font file does not seem to be valid Type1');
425 425
             }
426
-            $size2 = $pos-$size1;
427
-            $file = substr($file, 0, $size1+$size2);
426
+            $size2 = $pos - $size1;
427
+            $file = substr($file, 0, $size1 + $size2);
428 428
         }
429 429
         if (function_exists('gzcompress')) {
430
-            $cmp=$basename.'.z';
430
+            $cmp = $basename . '.z';
431 431
             saveToFile($cmp, gzcompress($file), 'b');
432
-            $s .= '$file=\''.$cmp."';\n";
433
-            echo 'Font file compressed ('.$cmp.')<br>';
432
+            $s .= '$file=\'' . $cmp . "';\n";
433
+            echo 'Font file compressed (' . $cmp . ')<br>';
434 434
         } else {
435
-            $s .= '$file=\''.basename($fontfile)."';\n";
435
+            $s .= '$file=\'' . basename($fontfile) . "';\n";
436 436
             echo '<b>Notice:</b> font file could not be compressed (zlib extension not available)<br>';
437 437
         }
438 438
         if ($type == 'Type1') {
439
-            $s .= '$size1='.$size1.";\n";
440
-            $s .= '$size2='.$size2.";\n";
439
+            $s .= '$size1=' . $size1 . ";\n";
440
+            $s .= '$size2=' . $size2 . ";\n";
441 441
         } else {
442
-            $s .= '$originalsize='.filesize($fontfile).";\n";
442
+            $s .= '$originalsize=' . filesize($fontfile) . ";\n";
443 443
         }
444 444
     } else {
445 445
         //Not embedded font
446
-        $s .= '$file='."'';\n";
446
+        $s .= '$file=' . "'';\n";
447 447
     }
448
-    $s.="?>\n";
449
-    saveToFile($basename.'.php', $s, 't');
450
-    echo 'Font definition file generated ('.$basename.'.php'.')<br>';
448
+    $s .= "?>\n";
449
+    saveToFile($basename . '.php', $s, 't');
450
+    echo 'Font definition file generated (' . $basename . '.php' . ')<br>';
451 451
 }
Please login to merge, or discard this patch.
src/Legacy/FPDF/Fpdf.php 1 patch
Spacing   +355 added lines, -355 removed lines patch added patch discarded remove patch
@@ -6,64 +6,64 @@  discard block
 block discarded – undo
6 6
 {
7 7
     const FPDF_VERSION = '1.6';
8 8
     
9
-    public $page;               //current page number
10
-    public $n;                  //current object number
11
-    public $offsets;            //array of object offsets
12
-    public $buffer;             //buffer holding in-memory PDF
13
-    public $pages;              //array containing pages
14
-    public $state;              //current document state
15
-    public $compress;           //compression flag
16
-    public $k;                  //scale factor (number of points in user unit)
17
-    public $defOrientation;     //default orientation
18
-    public $curOrientation;     //current orientation
19
-    public $pageFormats;        //available page formats
20
-    public $defPageFormat;      //default page format
21
-    public $curPageFormat;      //current page format
22
-    public $pageSizes;          //array storing non-default page sizes
9
+    public $page; //current page number
10
+    public $n; //current object number
11
+    public $offsets; //array of object offsets
12
+    public $buffer; //buffer holding in-memory PDF
13
+    public $pages; //array containing pages
14
+    public $state; //current document state
15
+    public $compress; //compression flag
16
+    public $k; //scale factor (number of points in user unit)
17
+    public $defOrientation; //default orientation
18
+    public $curOrientation; //current orientation
19
+    public $pageFormats; //available page formats
20
+    public $defPageFormat; //default page format
21
+    public $curPageFormat; //current page format
22
+    public $pageSizes; //array storing non-default page sizes
23 23
     public $wPt;
24
-    public $hPt;           //dimensions of current page in points
24
+    public $hPt; //dimensions of current page in points
25 25
     public $w;
26
-    public $h;               //dimensions of current page in user unit
27
-    public $lMargin;            //left margin
28
-    public $tMargin;            //top margin
29
-    public $rMargin;            //right margin
30
-    public $bMargin;            //page break margin
31
-    public $cMargin;            //cell margin
26
+    public $h; //dimensions of current page in user unit
27
+    public $lMargin; //left margin
28
+    public $tMargin; //top margin
29
+    public $rMargin; //right margin
30
+    public $bMargin; //page break margin
31
+    public $cMargin; //cell margin
32 32
     public $x;
33
-    public $y;               //current position in user unit
34
-    public $lasth;              //height of last printed cell
35
-    public $lineWidth;          //line width in user unit
36
-    public $coreFonts;          //array of standard font names
37
-    public $fonts;              //array of used fonts
38
-    public $fontFiles;          //array of font files
39
-    public $diffs;              //array of encoding differences
40
-    public $fontFamily;         //current font family
41
-    public $fontStyle;          //current font style
42
-    public $underline;          //underlining flag
43
-    public $currentFont;        //current font info
44
-    public $fontSizePt;         //current font size in points
45
-    public $fontSize;           //current font size in user unit
46
-    public $drawColor;          //commands for drawing color
47
-    public $fillColor;          //commands for filling color
48
-    public $textColor;          //commands for text color
49
-    public $colorFlag;          //indicates whether fill and text colors are different
50
-    public $ws;                 //word spacing
51
-    public $images;             //array of used images
52
-    public $PageLinks;          //array of links in pages
53
-    public $links;              //array of internal links
54
-    public $autoPageBreak;      //automatic page breaking
55
-    public $pageBreakTrigger;   //threshold used to trigger page breaks
56
-    public $inHeader;           //flag set when processing header
57
-    public $inFooter;           //flag set when processing footer
58
-    public $zoomMode;           //zoom display mode
59
-    public $layoutMode;         //layout display mode
60
-    public $title;              //title
61
-    public $subject;            //subject
62
-    public $author;             //author
63
-    public $keywords;           //keywords
64
-    public $creator;            //creator
65
-    public $aliasNbPages;       //alias for total number of pages
66
-    public $pdfVersion;         //PDF version number
33
+    public $y; //current position in user unit
34
+    public $lasth; //height of last printed cell
35
+    public $lineWidth; //line width in user unit
36
+    public $coreFonts; //array of standard font names
37
+    public $fonts; //array of used fonts
38
+    public $fontFiles; //array of font files
39
+    public $diffs; //array of encoding differences
40
+    public $fontFamily; //current font family
41
+    public $fontStyle; //current font style
42
+    public $underline; //underlining flag
43
+    public $currentFont; //current font info
44
+    public $fontSizePt; //current font size in points
45
+    public $fontSize; //current font size in user unit
46
+    public $drawColor; //commands for drawing color
47
+    public $fillColor; //commands for filling color
48
+    public $textColor; //commands for text color
49
+    public $colorFlag; //indicates whether fill and text colors are different
50
+    public $ws; //word spacing
51
+    public $images; //array of used images
52
+    public $PageLinks; //array of links in pages
53
+    public $links; //array of internal links
54
+    public $autoPageBreak; //automatic page breaking
55
+    public $pageBreakTrigger; //threshold used to trigger page breaks
56
+    public $inHeader; //flag set when processing header
57
+    public $inFooter; //flag set when processing footer
58
+    public $zoomMode; //zoom display mode
59
+    public $layoutMode; //layout display mode
60
+    public $title; //title
61
+    public $subject; //subject
62
+    public $author; //author
63
+    public $keywords; //keywords
64
+    public $creator; //creator
65
+    public $aliasNbPages; //alias for total number of pages
66
+    public $pdfVersion; //PDF version number
67 67
     
68 68
     public function __construct($orientation = 'P', $unit = 'mm', $format = 'A4')
69 69
     {
@@ -114,21 +114,21 @@  discard block
 block discarded – undo
114 114
         if ($unit == 'pt') {
115 115
             $this->k = 1;
116 116
         } elseif ($unit == 'mm') {
117
-            $this->k = 72/25.4;
117
+            $this->k = 72 / 25.4;
118 118
         } elseif ($unit == 'cm') {
119
-            $this->k = 72/2.54;
119
+            $this->k = 72 / 2.54;
120 120
         } elseif ($unit == 'in') {
121 121
             $this->k = 72;
122 122
         } else {
123
-            $this->error('Incorrect unit: '.$unit);
123
+            $this->error('Incorrect unit: ' . $unit);
124 124
         }
125 125
         //Page format
126 126
         $this->pageFormats = array(
127
-            'a3' => array(841.89,1190.55),
128
-            'a4' => array(595.28,841.89),
129
-            'a5' => array(420.94,595.28),
130
-            'letter' => array(612,792),
131
-            'legal' => array(612,1008)
127
+            'a3' => array(841.89, 1190.55),
128
+            'a4' => array(595.28, 841.89),
129
+            'a5' => array(420.94, 595.28),
130
+            'letter' => array(612, 792),
131
+            'legal' => array(612, 1008)
132 132
         );
133 133
         if (is_string($format)) {
134 134
             $format = $this->getpageformat($format);
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         //Page orientation
139 139
         $orientation = strtolower($orientation);
140 140
         if ($orientation == 'p' || $orientation == 'portrait') {
141
-            $this->defOrientation='P';
141
+            $this->defOrientation = 'P';
142 142
             $this->w = $this->defPageFormat[0];
143 143
             $this->h = $this->defPageFormat[1];
144 144
         } elseif ($orientation == 'l' || $orientation == 'landscape') {
@@ -146,26 +146,26 @@  discard block
 block discarded – undo
146 146
             $this->w = $this->defPageFormat[1];
147 147
             $this->h = $this->defPageFormat[0];
148 148
         } else {
149
-            $this->error('Incorrect orientation: '.$orientation);
149
+            $this->error('Incorrect orientation: ' . $orientation);
150 150
         }
151 151
         $this->curOrientation = $this->defOrientation;
152
-        $this->wPt = $this->w*$this->k;
153
-        $this->hPt = $this->h*$this->k;
152
+        $this->wPt = $this->w * $this->k;
153
+        $this->hPt = $this->h * $this->k;
154 154
         //Page margins (1 cm)
155
-        $margin = 28.35/$this->k;
155
+        $margin = 28.35 / $this->k;
156 156
         $this->setMargins($margin, $margin);
157 157
         //Interior cell margin (1 mm)
158
-        $this->cMargin = $margin/10;
158
+        $this->cMargin = $margin / 10;
159 159
         //Line width (0.2 mm)
160
-        $this->lineWidth = .567/$this->k;
160
+        $this->lineWidth = .567 / $this->k;
161 161
         //Automatic page break
162
-        $this->setAutoPageBreak(true, 2*$margin);
162
+        $this->setAutoPageBreak(true, 2 * $margin);
163 163
         //Full width display mode
164 164
         $this->setDisplayMode('fullwidth');
165 165
         //Enable compression
166 166
         $this->setCompression(true);
167 167
         //Set default PDF version number
168
-        $this->pdfVersion='1.3';
168
+        $this->pdfVersion = '1.3';
169 169
     }
170 170
 
171 171
     public function setMargins($left, $top, $right = null)
@@ -176,14 +176,14 @@  discard block
 block discarded – undo
176 176
         if ($right === null) {
177 177
             $right = $left;
178 178
         }
179
-        $this->rMargin=$right;
179
+        $this->rMargin = $right;
180 180
     }
181 181
 
182 182
     public function setLeftMargin($margin)
183 183
     {
184 184
         //Set left margin
185 185
         $this->lMargin = $margin;
186
-        if ($this->page>0 && $this->x<$margin) {
186
+        if ($this->page > 0 && $this->x < $margin) {
187 187
             $this->x = $margin;
188 188
         }
189 189
     }
@@ -205,21 +205,21 @@  discard block
 block discarded – undo
205 205
         //Set auto page break mode and triggering margin
206 206
         $this->autoPageBreak = $auto;
207 207
         $this->bMargin = $margin;
208
-        $this->pageBreakTrigger = $this->h-$margin;
208
+        $this->pageBreakTrigger = $this->h - $margin;
209 209
     }
210 210
 
211 211
     public function setDisplayMode($zoom, $layout = 'continuous')
212 212
     {
213 213
         //Set display mode in viewer
214
-        if ($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom)) {
214
+        if ($zoom == 'fullpage' || $zoom == 'fullwidth' || $zoom == 'real' || $zoom == 'default' || !is_string($zoom)) {
215 215
             $this->zoomMode = $zoom;
216 216
         } else {
217
-            $this->error('Incorrect zoom display mode: '.$zoom);
217
+            $this->error('Incorrect zoom display mode: ' . $zoom);
218 218
         }
219
-        if ($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default') {
219
+        if ($layout == 'single' || $layout == 'continuous' || $layout == 'two' || $layout == 'default') {
220 220
             $this->layoutMode = $layout;
221 221
         } else {
222
-            $this->error('Incorrect layout display mode: '.$layout);
222
+            $this->error('Incorrect layout display mode: ' . $layout);
223 223
         }
224 224
     }
225 225
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
         if ($isUTF8) {
258 258
             $author = $this->utf8Toutf16($author);
259 259
         }
260
-        $this->author=$author;
260
+        $this->author = $author;
261 261
     }
262 262
 
263 263
     public function setKeywords($keywords, $isUTF8 = false)
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
     public function aliasNbPages($alias = '{nb}')
282 282
     {
283 283
         //Define an alias for total number of pages
284
-        $this->aliasNbPages=$alias;
284
+        $this->aliasNbPages = $alias;
285 285
     }
286 286
 
287 287
     public function error($msg)
@@ -317,11 +317,11 @@  discard block
 block discarded – undo
317 317
     public function addPage($orientation = '', $format = '')
318 318
     {
319 319
         //Start a new page
320
-        if ($this->state==0) {
320
+        if ($this->state == 0) {
321 321
             $this->open();
322 322
         }
323 323
         $family = $this->fontFamily;
324
-        $style = $this->fontStyle.($this->underline ? 'U' : '');
324
+        $style = $this->fontStyle . ($this->underline ? 'U' : '');
325 325
         $size = $this->fontSizePt;
326 326
         $lw = $this->lineWidth;
327 327
         $dc = $this->drawColor;
@@ -342,14 +342,14 @@  discard block
 block discarded – undo
342 342
         $this->out('2 J');
343 343
         //Set line width
344 344
         $this->lineWidth = $lw;
345
-        $this->out(sprintf('%.2F w', $lw*$this->k));
345
+        $this->out(sprintf('%.2F w', $lw * $this->k));
346 346
         //Set font
347 347
         if ($family) {
348 348
             $this->setFont($family, $style, $size);
349 349
         }
350 350
         //Set colors
351 351
         $this->drawColor = $dc;
352
-        if ($dc!='0 G') {
352
+        if ($dc != '0 G') {
353 353
             $this->out($dc);
354 354
         }
355 355
         $this->fillColor = $fc;
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
         //Restore line width
366 366
         if ($this->lineWidth != $lw) {
367 367
             $this->lineWidth = $lw;
368
-            $this->out(sprintf('%.2F w', $lw*$this->k));
368
+            $this->out(sprintf('%.2F w', $lw * $this->k));
369 369
         }
370 370
         //Restore font
371 371
         if ($family) {
@@ -403,10 +403,10 @@  discard block
 block discarded – undo
403 403
     public function setDrawColor($r, $g = null, $b = null)
404 404
     {
405 405
         //Set color for all stroking operations
406
-        if (($r==0 && $g==0 && $b==0) || $g===null) {
407
-            $this->drawColor = sprintf('%.3F G', $r/255);
406
+        if (($r == 0 && $g == 0 && $b == 0) || $g === null) {
407
+            $this->drawColor = sprintf('%.3F G', $r / 255);
408 408
         } else {
409
-            $this->drawColor = sprintf('%.3F %.3F %.3F RG', $r/255, $g/255, $b/255);
409
+            $this->drawColor = sprintf('%.3F %.3F %.3F RG', $r / 255, $g / 255, $b / 255);
410 410
         }
411 411
         if ($this->page > 0) {
412 412
             $this->out($this->drawColor);
@@ -416,10 +416,10 @@  discard block
 block discarded – undo
416 416
     public function setFillColor($r, $g = null, $b = null)
417 417
     {
418 418
         //Set color for all filling operations
419
-        if (($r==0 && $g==0 && $b==0) || $g===null) {
420
-            $this->fillColor = sprintf('%.3F g', $r/255);
419
+        if (($r == 0 && $g == 0 && $b == 0) || $g === null) {
420
+            $this->fillColor = sprintf('%.3F g', $r / 255);
421 421
         } else {
422
-            $this->fillColor = sprintf('%.3F %.3F %.3F rg', $r/255, $g/255, $b/255);
422
+            $this->fillColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255);
423 423
         }
424 424
         $this->colorFlag = ($this->fillColor != $this->textColor);
425 425
         if ($this->page > 0) {
@@ -430,10 +430,10 @@  discard block
 block discarded – undo
430 430
     public function settextColor($r, $g = null, $b = null)
431 431
     {
432 432
         //Set color for text
433
-        if (($r==0 && $g==0 && $b==0) || $g===null) {
434
-            $this->textColor = sprintf('%.3F g', $r/255);
433
+        if (($r == 0 && $g == 0 && $b == 0) || $g === null) {
434
+            $this->textColor = sprintf('%.3F g', $r / 255);
435 435
         } else {
436
-            $this->textColor = sprintf('%.3F %.3F %.3F rg', $r/255, $g/255, $b/255);
436
+            $this->textColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255);
437 437
         }
438 438
         $this->colorFlag = ($this->fillColor != $this->textColor);
439 439
     }
@@ -441,14 +441,14 @@  discard block
 block discarded – undo
441 441
     public function getStringWidth($s)
442 442
     {
443 443
         //Get width of a string in the current font
444
-        $s = (string)$s;
445
-        $cw =& $this->currentFont['cw'];
444
+        $s = (string) $s;
445
+        $cw = & $this->currentFont['cw'];
446 446
         $w = 0;
447 447
         $l = strlen($s);
448
-        for ($i=0; $i<$l; $i++) {
448
+        for ($i = 0; $i < $l; $i++) {
449 449
             $w += $cw[$s[$i]];
450 450
         }
451
-        return $w*$this->fontSize/1000;
451
+        return $w * $this->fontSize / 1000;
452 452
     }
453 453
 
454 454
     public function setLineWidth($width)
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
         //Set line width
457 457
         $this->lineWidth = $width;
458 458
         if ($this->page > 0) {
459
-            $this->out(sprintf('%.2F w', $width*$this->k));
459
+            $this->out(sprintf('%.2F w', $width * $this->k));
460 460
         }
461 461
     }
462 462
 
@@ -466,10 +466,10 @@  discard block
 block discarded – undo
466 466
         $this->out(
467 467
             sprintf(
468 468
                 '%.2F %.2F m %.2F %.2F l S',
469
-                $x1*$this->k,
470
-                ($this->h-$y1)*$this->k,
471
-                $x2*$this->k,
472
-                ($this->h-$y2)*$this->k
469
+                $x1 * $this->k,
470
+                ($this->h - $y1) * $this->k,
471
+                $x2 * $this->k,
472
+                ($this->h - $y2) * $this->k
473 473
             )
474 474
         );
475 475
     }
@@ -487,10 +487,10 @@  discard block
 block discarded – undo
487 487
         $this->out(
488 488
             sprintf(
489 489
                 '%.2F %.2F %.2F %.2F re %s',
490
-                $x*$this->k,
491
-                ($this->h-$y)*$this->k,
492
-                $w*$this->k,
493
-                -$h*$this->k,
490
+                $x * $this->k,
491
+                ($this->h - $y) * $this->k,
492
+                $w * $this->k,
493
+                -$h * $this->k,
494 494
                 $op
495 495
             )
496 496
         );
@@ -501,24 +501,24 @@  discard block
 block discarded – undo
501 501
         //Add a TrueType or Type1 font
502 502
         $family = strtolower($family);
503 503
         if ($file == '') {
504
-            $file = str_replace(' ', '', $family).strtolower($style).'.php';
504
+            $file = str_replace(' ', '', $family) . strtolower($style) . '.php';
505 505
         }
506
-        if ($family=='arial') {
507
-            $family='helvetica';
506
+        if ($family == 'arial') {
507
+            $family = 'helvetica';
508 508
         }
509 509
         $style = strtoupper($style);
510 510
         if ($style == 'IB') {
511 511
             $style = 'BI';
512 512
         }
513
-        $fontkey = $family.$style;
513
+        $fontkey = $family . $style;
514 514
         if (isset($this->fonts[$fontkey])) {
515 515
             return;
516 516
         }
517
-        include $this->getFontPath().$file;
517
+        include $this->getFontPath() . $file;
518 518
         if (!isset($name)) {
519 519
             $this->error('Could not include font definition file');
520 520
         }
521
-        $i = count($this->fonts)+1;
521
+        $i = count($this->fonts) + 1;
522 522
         $this->fonts[$fontkey] = [
523 523
             'i'=>$i,
524 524
             'type'=>$type,
@@ -534,20 +534,20 @@  discard block
 block discarded – undo
534 534
             //Search existing encodings
535 535
             $d = 0;
536 536
             $nb = count($this->diffs);
537
-            for ($i=1; $i<=$nb; $i++) {
537
+            for ($i = 1; $i <= $nb; $i++) {
538 538
                 if ($this->diffs[$i] == $diff) {
539 539
                     $d = $i;
540 540
                     break;
541 541
                 }
542 542
             }
543 543
             if ($d == 0) {
544
-                $d = $nb+1;
544
+                $d = $nb + 1;
545 545
                 $this->diffs[$d] = $diff;
546 546
             }
547 547
             $this->fonts[$fontkey]['diff'] = $d;
548 548
         }
549 549
         if ($file) {
550
-            if ($type=='TrueType') {
550
+            if ($type == 'TrueType') {
551 551
                 $this->fontFiles[$file] = array('length1'=>$originalsize);
552 552
             } else {
553 553
                 $this->fontFiles[$file] = array('length1'=>$size1, 'length2'=>$size2);
@@ -582,39 +582,39 @@  discard block
 block discarded – undo
582 582
             $size = $this->fontSizePt;
583 583
         }
584 584
         //Test if font is already selected
585
-        if ($this->fontFamily==$family && $this->fontStyle==$style && $this->fontSizePt==$size) {
585
+        if ($this->fontFamily == $family && $this->fontStyle == $style && $this->fontSizePt == $size) {
586 586
             return;
587 587
         }
588 588
         //Test if used for the first time
589
-        $fontkey = $family.$style;
589
+        $fontkey = $family . $style;
590 590
         if (!isset($this->fonts[$fontkey])) {
591 591
             //Check if one of the standard fonts
592 592
             if (isset($this->coreFonts[$fontkey])) {
593 593
                 if (!isset($fpdf_charwidths[$fontkey])) {
594 594
                     //Load metric file
595
-                    $file=$family;
596
-                    if ($family=='times' || $family=='helvetica') {
595
+                    $file = $family;
596
+                    if ($family == 'times' || $family == 'helvetica') {
597 597
                         $file .= strtolower($style);
598 598
                     }
599
-                    include $this->getFontPath().$file.'.php';
599
+                    include $this->getFontPath() . $file . '.php';
600 600
                     if (!isset($fpdf_charwidths[$fontkey])) {
601 601
                         $this->error('Could not include font metric file');
602 602
                     }
603 603
                 }
604
-                $i = count($this->fonts)+1;
604
+                $i = count($this->fonts) + 1;
605 605
                 $name = $this->coreFonts[$fontkey];
606 606
                 $cw = $fpdf_charwidths[$fontkey];
607 607
                 $this->fonts[$fontkey] = ['i'=>$i, 'type'=>'core', 'name'=>$name, 'up'=>-100, 'ut'=>50, 'cw'=>$cw];
608 608
             } else {
609
-                $this->error('Undefined font: '.$family.' '.$style);
609
+                $this->error('Undefined font: ' . $family . ' ' . $style);
610 610
             }
611 611
         }
612 612
         //Select it
613 613
         $this->fontFamily = $family;
614 614
         $this->fontStyle = $style;
615 615
         $this->fontSizePt = $size;
616
-        $this->fontSize = $size/$this->k;
617
-        $this->currentFont =& $this->fonts[$fontkey];
616
+        $this->fontSize = $size / $this->k;
617
+        $this->currentFont = & $this->fonts[$fontkey];
618 618
         if ($this->page > 0) {
619 619
             $this->out(sprintf('BT /F%d %.2F Tf ET', $this->currentFont['i'], $this->fontSizePt));
620 620
         }
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
             return;
628 628
         }
629 629
         $this->fontSizePt = $size;
630
-        $this->fontSize = $size/$this->k;
630
+        $this->fontSize = $size / $this->k;
631 631
         if ($this->page > 0) {
632 632
             $this->out(sprintf('BT /F%d %.2F Tf ET', $this->currentFont['i'], $this->fontSizePt));
633 633
         }
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
     public function addlink()
637 637
     {
638 638
         //Create a new internal link
639
-        $n = count($this->links)+1;
639
+        $n = count($this->links) + 1;
640 640
         $this->links[$n] = array(0, 0);
641 641
         return $n;
642 642
     }
@@ -657,10 +657,10 @@  discard block
 block discarded – undo
657 657
     {
658 658
         //Put a link on the page
659 659
         $this->PageLinks[$this->page][] = [
660
-            $x*$this->k,
661
-            $this->hPt-$y*$this->k,
662
-            $w*$this->k,
663
-            $h*$this->k,
660
+            $x * $this->k,
661
+            $this->hPt - $y * $this->k,
662
+            $w * $this->k,
663
+            $h * $this->k,
664 664
             $link
665 665
         ];
666 666
     }
@@ -668,12 +668,12 @@  discard block
 block discarded – undo
668 668
     public function text($x, $y, $txt)
669 669
     {
670 670
         //Output a string
671
-        $s = sprintf('BT %.2F %.2F Td (%s) Tj ET', $x*$this->k, ($this->h-$y)*$this->k, $this->escape($txt));
672
-        if ($this->underline && $txt!='') {
673
-            $s .= ' '.$this->doUnderLine($x, $y, $txt);
671
+        $s = sprintf('BT %.2F %.2F Td (%s) Tj ET', $x * $this->k, ($this->h - $y) * $this->k, $this->escape($txt));
672
+        if ($this->underline && $txt != '') {
673
+            $s .= ' ' . $this->doUnderLine($x, $y, $txt);
674 674
         }
675 675
         if ($this->colorFlag) {
676
-            $s = 'q '.$this->textColor.' '.$s.' Q';
676
+            $s = 'q ' . $this->textColor . ' ' . $s . ' Q';
677 677
         }
678 678
         $this->out($s);
679 679
     }
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
     {
689 689
         //Output a cell
690 690
         $k = $this->k;
691
-        if ($this->y+$h > $this->PageBreakTrigger
691
+        if ($this->y + $h > $this->PageBreakTrigger
692 692
             && !$this->InHeader
693 693
             && !$this->InFooter
694 694
             && $this->acceptPageBreak()
@@ -704,77 +704,77 @@  discard block
 block discarded – undo
704 704
             $this->x = $x;
705 705
             if ($ws > 0) {
706 706
                 $this->ws = $ws;
707
-                $this->out(sprintf('%.3F Tw', $ws*$k));
707
+                $this->out(sprintf('%.3F Tw', $ws * $k));
708 708
             }
709 709
         }
710 710
         if ($w == 0) {
711
-            $w = $this->w-$this->rMargin-$this->x;
711
+            $w = $this->w - $this->rMargin - $this->x;
712 712
         }
713
-        $s='';
714
-        if ($fill || $border==1) {
713
+        $s = '';
714
+        if ($fill || $border == 1) {
715 715
             if ($fill) {
716
-                $op=($border==1) ? 'B' : 'f';
716
+                $op = ($border == 1) ? 'B' : 'f';
717 717
             } else {
718
-                $op='S';
718
+                $op = 'S';
719 719
             }
720
-            $s=sprintf('%.2F %.2F %.2F %.2F re %s ', $this->x*$k, ($this->h-$this->y)*$k, $w*$k, -$h*$k, $op);
720
+            $s = sprintf('%.2F %.2F %.2F %.2F re %s ', $this->x * $k, ($this->h - $this->y) * $k, $w * $k, -$h * $k, $op);
721 721
         }
722 722
         if (is_string($border)) {
723 723
             $x = $this->x;
724 724
             $y = $this->y;
725 725
             if (strpos($border, 'L') !== false) {
726
-                $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x*$k, ($this->h-$y)*$k, $x*$k, ($this->h-($y+$h))*$k);
726
+                $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x * $k, ($this->h - $y) * $k, $x * $k, ($this->h - ($y + $h)) * $k);
727 727
             }
728 728
             if (strpos($border, 'T') !== false) {
729
-                $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x*$k, ($this->h-$y)*$k, ($x+$w)*$k, ($this->h-$y)*$k);
729
+                $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x * $k, ($this->h - $y) * $k, ($x + $w) * $k, ($this->h - $y) * $k);
730 730
             }
731 731
             if (strpos($border, 'R') !== false) {
732 732
                 $s .= sprintf(
733 733
                     '%.2F %.2F m %.2F %.2F l S ',
734
-                    ($x+$w)*$k,
735
-                    ($this->h-$y)*$k,
736
-                    ($x+$w)*$k,
737
-                    ($this->h-($y+$h))*$k
734
+                    ($x + $w) * $k,
735
+                    ($this->h - $y) * $k,
736
+                    ($x + $w) * $k,
737
+                    ($this->h - ($y + $h)) * $k
738 738
                 );
739 739
             }
740 740
             if (strpos($border, 'B') !== false) {
741 741
                 $s .= sprintf(
742 742
                     '%.2F %.2F m %.2F %.2F l S ',
743
-                    $x*$k,
744
-                    ($this->h-($y+$h))*$k,
745
-                    ($x+$w)*$k,
746
-                    ($this->h-($y+$h))*$k
743
+                    $x * $k,
744
+                    ($this->h - ($y + $h)) * $k,
745
+                    ($x + $w) * $k,
746
+                    ($this->h - ($y + $h)) * $k
747 747
                 );
748 748
             }
749 749
         }
750 750
         if ($txt !== '') {
751 751
             if ($align == 'R') {
752
-                $dx = $w-$this->cMargin-$this->getStringWidth($txt);
752
+                $dx = $w - $this->cMargin - $this->getStringWidth($txt);
753 753
             } elseif ($align == 'C') {
754
-                $dx = ($w-$this->getStringWidth($txt))/2;
754
+                $dx = ($w - $this->getStringWidth($txt)) / 2;
755 755
             } else {
756 756
                 $dx = $this->cMargin;
757 757
             }
758 758
             if ($this->colorFlag) {
759
-                $s .= 'q '.$this->textColor.' ';
759
+                $s .= 'q ' . $this->textColor . ' ';
760 760
             }
761 761
             $txt2 = str_replace(')', '\\)', str_replace('(', '\\(', str_replace('\\', '\\\\', $txt)));
762 762
             $s .= sprintf(
763 763
                 'BT %.2F %.2F Td (%s) Tj ET',
764
-                ($this->x+$dx)*$k,
765
-                ($this->h-($this->y+.5*$h+.3*$this->fontSize))*$k,
764
+                ($this->x + $dx) * $k,
765
+                ($this->h - ($this->y + .5 * $h + .3 * $this->fontSize)) * $k,
766 766
                 $txt2
767 767
             );
768 768
             if ($this->underline) {
769
-                $s .= ' '.$this->doUnderLine($this->x+$dx, $this->y+.5*$h+.3*$this->fontSize, $txt);
769
+                $s .= ' ' . $this->doUnderLine($this->x + $dx, $this->y + .5 * $h + .3 * $this->fontSize, $txt);
770 770
             }
771 771
             if ($this->colorFlag) {
772
-                $s.=' Q';
772
+                $s .= ' Q';
773 773
             }
774 774
             if ($link) {
775 775
                 $this->link(
776
-                    $this->x+$dx,
777
-                    $this->y+.5*$h-.5*$this->fontSize,
776
+                    $this->x + $dx,
777
+                    $this->y + .5 * $h - .5 * $this->fontSize,
778 778
                     $this->getStringWidth($txt),
779 779
                     $this->fontSize,
780 780
                     $link
@@ -799,14 +799,14 @@  discard block
 block discarded – undo
799 799
     public function multicell($w, $h, $txt, $border = 0, $align = 'J', $fill = false)
800 800
     {
801 801
         //Output text with automatic or explicit line breaks
802
-        $cw =& $this->currentFont['cw'];
802
+        $cw = & $this->currentFont['cw'];
803 803
         if ($w == 0) {
804
-            $w = $this->w-$this->rMargin-$this->x;
804
+            $w = $this->w - $this->rMargin - $this->x;
805 805
         }
806
-        $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize;
806
+        $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize;
807 807
         $s = str_replace("\r", '', $txt);
808 808
         $nb = strlen($s);
809
-        if ($nb>0 && $s[$nb-1] == "\n") {
809
+        if ($nb > 0 && $s[$nb - 1] == "\n") {
810 810
             $nb--;
811 811
         }
812 812
         $b = 0;
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
                 if (strpos($border, 'R') !== false) {
824 824
                     $b2 .= 'R';
825 825
                 }
826
-                $b=(strpos($border, 'T') !== false) ? $b2.'T' : $b2;
826
+                $b = (strpos($border, 'T') !== false) ? $b2 . 'T' : $b2;
827 827
             }
828 828
         }
829 829
         $sep = -1;
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
         $l = 0;
833 833
         $ns = 0;
834 834
         $nl = 1;
835
-        while ($i<$nb) {
835
+        while ($i < $nb) {
836 836
             //Get next character
837 837
             $c = $s[$i];
838 838
             if ($c == "\n") {
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
                     $this->ws = 0;
842 842
                     $this->out('0 Tw');
843 843
                 }
844
-                $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill);
844
+                $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
845 845
                 $i++;
846 846
                 $sep = -1;
847 847
                 $j = $i;
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
                 $ns = 0;
850 850
                 $nl++;
851 851
                 if ($border && $nl == 2) {
852
-                    $b=$b2;
852
+                    $b = $b2;
853 853
                 }
854 854
                 continue;
855 855
             }
@@ -869,14 +869,14 @@  discard block
 block discarded – undo
869 869
                         $this->ws = 0;
870 870
                         $this->out('0 Tw');
871 871
                     }
872
-                    $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill);
872
+                    $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
873 873
                 } else {
874
-                    if ($align=='J') {
875
-                        $this->ws = ($ns>1) ? ($wmax-$ls)/1000*$this->fontSize/($ns-1) : 0;
876
-                        $this->out(sprintf('%.3F Tw', $this->ws*$this->k));
874
+                    if ($align == 'J') {
875
+                        $this->ws = ($ns > 1) ? ($wmax - $ls) / 1000 * $this->fontSize / ($ns - 1) : 0;
876
+                        $this->out(sprintf('%.3F Tw', $this->ws * $this->k));
877 877
                     }
878
-                    $this->cell($w, $h, substr($s, $j, $sep-$j), $b, 2, $align, $fill);
879
-                    $i = $sep+1;
878
+                    $this->cell($w, $h, substr($s, $j, $sep - $j), $b, 2, $align, $fill);
879
+                    $i = $sep + 1;
880 880
                 }
881 881
                 $sep = -1;
882 882
                 $j = $i;
@@ -895,19 +895,19 @@  discard block
 block discarded – undo
895 895
             $this->ws = 0;
896 896
             $this->out('0 Tw');
897 897
         }
898
-        if ($border && strpos($border, 'B')!==false) {
898
+        if ($border && strpos($border, 'B') !== false) {
899 899
             $b .= 'B';
900 900
         }
901
-        $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill);
901
+        $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
902 902
         $this->x = $this->lMargin;
903 903
     }
904 904
 
905 905
     public function write($h, $txt, $link = '')
906 906
     {
907 907
         //Output text in flowing mode
908
-        $cw =& $this->currentFont['cw'];
909
-        $w = $this->w-$this->rMargin-$this->x;
910
-        $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize;
908
+        $cw = & $this->currentFont['cw'];
909
+        $w = $this->w - $this->rMargin - $this->x;
910
+        $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize;
911 911
         $s = str_replace("\r", '', $txt);
912 912
         $nb = strlen($s);
913 913
         $sep = -1;
@@ -917,18 +917,18 @@  discard block
 block discarded – undo
917 917
         $nl = 1;
918 918
         while ($i < $nb) {
919 919
             //Get next character
920
-            $c=$s[$i];
921
-            if ($c=="\n") {
920
+            $c = $s[$i];
921
+            if ($c == "\n") {
922 922
                 //Explicit line break
923
-                $this->cell($w, $h, substr($s, $j, $i-$j), 0, 2, '', 0, $link);
923
+                $this->cell($w, $h, substr($s, $j, $i - $j), 0, 2, '', 0, $link);
924 924
                 $i++;
925 925
                 $sep = -1;
926 926
                 $j = $i;
927 927
                 $l = 0;
928 928
                 if ($nl == 1) {
929 929
                     $this->x = $this->lMargin;
930
-                    $w = $this->w-$this->rMargin-$this->x;
931
-                    $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize;
930
+                    $w = $this->w - $this->rMargin - $this->x;
931
+                    $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize;
932 932
                 }
933 933
                 $nl++;
934 934
                 continue;
@@ -944,8 +944,8 @@  discard block
 block discarded – undo
944 944
                         //Move to next line
945 945
                         $this->x = $this->lMargin;
946 946
                         $this->y += $h;
947
-                        $w = $this->w-$this->rMargin-$this->x;
948
-                        $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize;
947
+                        $w = $this->w - $this->rMargin - $this->x;
948
+                        $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize;
949 949
                         $i++;
950 950
                         $nl++;
951 951
                         continue;
@@ -953,18 +953,18 @@  discard block
 block discarded – undo
953 953
                     if ($i == $j) {
954 954
                         $i++;
955 955
                     }
956
-                    $this->cell($w, $h, substr($s, $j, $i-$j), 0, 2, '', 0, $link);
956
+                    $this->cell($w, $h, substr($s, $j, $i - $j), 0, 2, '', 0, $link);
957 957
                 } else {
958
-                    $this->cell($w, $h, substr($s, $j, $sep-$j), 0, 2, '', 0, $link);
959
-                    $i = $sep+1;
958
+                    $this->cell($w, $h, substr($s, $j, $sep - $j), 0, 2, '', 0, $link);
959
+                    $i = $sep + 1;
960 960
                 }
961 961
                 $sep = -1;
962 962
                 $j = $i;
963 963
                 $l = 0;
964 964
                 if ($nl == 1) {
965 965
                     $this->x = $this->lMargin;
966
-                    $w = $this->w-$this->rMargin-$this->x;
967
-                    $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize;
966
+                    $w = $this->w - $this->rMargin - $this->x;
967
+                    $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize;
968 968
                 }
969 969
                 $nl++;
970 970
             } else {
@@ -973,7 +973,7 @@  discard block
 block discarded – undo
973 973
         }
974 974
         //Last chunk
975 975
         if ($i != $j) {
976
-            $this->cell($l/1000*$this->fontSize, $h, substr($s, $j), 0, 0, '', 0, $link);
976
+            $this->cell($l / 1000 * $this->fontSize, $h, substr($s, $j), 0, 0, '', 0, $link);
977 977
         }
978 978
     }
979 979
 
@@ -996,20 +996,20 @@  discard block
 block discarded – undo
996 996
             if ($type == '') {
997 997
                 $pos = strrpos($file, '.');
998 998
                 if (!$pos) {
999
-                    $this->error('Image file has no extension and no type was specified: '.$file);
999
+                    $this->error('Image file has no extension and no type was specified: ' . $file);
1000 1000
                 }
1001
-                $type = substr($file, $pos+1);
1001
+                $type = substr($file, $pos + 1);
1002 1002
             }
1003 1003
             $type = strtolower($type);
1004 1004
             if ($type == 'jpeg') {
1005 1005
                 $type = 'jpg';
1006 1006
             }
1007
-            $mtd = 'parse'.strtoupper($type);
1007
+            $mtd = 'parse' . strtoupper($type);
1008 1008
             if (!method_exists($this, $mtd)) {
1009
-                $this->error('Unsupported image type: '.$type);
1009
+                $this->error('Unsupported image type: ' . $type);
1010 1010
             }
1011 1011
             $info = $this->$mtd($file);
1012
-            $info['i'] = count($this->images)+1;
1012
+            $info['i'] = count($this->images) + 1;
1013 1013
             $this->images[$file] = $info;
1014 1014
         } else {
1015 1015
             $info = $this->images[$file];
@@ -1017,16 +1017,16 @@  discard block
 block discarded – undo
1017 1017
         //Automatic width and height calculation if needed
1018 1018
         if ($w == 0 && $h == 0) {
1019 1019
             //Put image at 72 dpi
1020
-            $w = $info['w']/$this->k;
1021
-            $h = $info['h']/$this->k;
1020
+            $w = $info['w'] / $this->k;
1021
+            $h = $info['h'] / $this->k;
1022 1022
         } elseif ($w == 0) {
1023
-            $w = $h*$info['w']/$info['h'];
1023
+            $w = $h * $info['w'] / $info['h'];
1024 1024
         } elseif ($h == 0) {
1025
-            $h = $w*$info['h']/$info['w'];
1025
+            $h = $w * $info['h'] / $info['w'];
1026 1026
         }
1027 1027
         //Flowing mode
1028 1028
         if ($y === null) {
1029
-            if ($this->y+$h > $this->pageBreakTrigger
1029
+            if ($this->y + $h > $this->pageBreakTrigger
1030 1030
                 && !$this->inHeader
1031 1031
                 && !$this->inFooter
1032 1032
                 && $this->acceptPageBreak()
@@ -1045,10 +1045,10 @@  discard block
 block discarded – undo
1045 1045
         $this->out(
1046 1046
             sprintf(
1047 1047
                 'q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q',
1048
-                $w*$this->k,
1049
-                $h*$this->k,
1050
-                $x*$this->k,
1051
-                ($this->h-($y+$h))*$this->k,
1048
+                $w * $this->k,
1049
+                $h * $this->k,
1050
+                $x * $this->k,
1051
+                ($this->h - ($y + $h)) * $this->k,
1052 1052
                 $info['i']
1053 1053
             )
1054 1054
         );
@@ -1069,7 +1069,7 @@  discard block
 block discarded – undo
1069 1069
         if ($x >= 0) {
1070 1070
             $this->x = $x;
1071 1071
         } else {
1072
-            $this->x = $this->w+$x;
1072
+            $this->x = $this->w + $x;
1073 1073
         }
1074 1074
     }
1075 1075
 
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
         if ($y >= 0) {
1087 1087
             $this->y = $y;
1088 1088
         } else {
1089
-            $this->y = $this->h+$y;
1089
+            $this->y = $this->h + $y;
1090 1090
         }
1091 1091
     }
1092 1092
 
@@ -1132,8 +1132,8 @@  discard block
 block discarded – undo
1132 1132
                     if (headers_sent()) {
1133 1133
                         $this->error('Some data has already been output, can\'t send PDF file');
1134 1134
                     }
1135
-                    header('Content-Length: '.strlen($this->buffer));
1136
-                    header('Content-Disposition: inline; filename="'.$name.'"');
1135
+                    header('Content-Length: ' . strlen($this->buffer));
1136
+                    header('Content-Disposition: inline; filename="' . $name . '"');
1137 1137
                     header('Cache-Control: private, max-age=0, must-revalidate');
1138 1138
                     header('Pragma: public');
1139 1139
                     ini_set('zlib.output_compression', '0');
@@ -1149,8 +1149,8 @@  discard block
 block discarded – undo
1149 1149
                 if (headers_sent()) {
1150 1150
                     $this->error('Some data has already been output, can\'t send PDF file');
1151 1151
                 }
1152
-                header('Content-Length: '.strlen($this->buffer));
1153
-                header('Content-Disposition: attachment; filename="'.$name.'"');
1152
+                header('Content-Length: ' . strlen($this->buffer));
1153
+                header('Content-Disposition: attachment; filename="' . $name . '"');
1154 1154
                 header('Cache-Control: private, max-age=0, must-revalidate');
1155 1155
                 header('Pragma: public');
1156 1156
                 ini_set('zlib.output_compression', '0');
@@ -1158,9 +1158,9 @@  discard block
 block discarded – undo
1158 1158
                 break;
1159 1159
             case 'F':
1160 1160
                 //Save to local file
1161
-                $f=fopen($name, 'wb');
1161
+                $f = fopen($name, 'wb');
1162 1162
                 if (!$f) {
1163
-                    $this->error('Unable to create output file: '.$name);
1163
+                    $this->error('Unable to create output file: ' . $name);
1164 1164
                 }
1165 1165
                 fwrite($f, $this->buffer, strlen($this->buffer));
1166 1166
                 fclose($f);
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
                 //Return as a string
1170 1170
                 return $this->buffer;
1171 1171
             default:
1172
-                $this->error('Incorrect output destination: '.$dest);
1172
+                $this->error('Incorrect output destination: ' . $dest);
1173 1173
         }
1174 1174
         return '';
1175 1175
     }
@@ -1177,7 +1177,7 @@  discard block
 block discarded – undo
1177 1177
     protected function dochecks()
1178 1178
     {
1179 1179
         //Check availability of %F
1180
-        if (sprintf('%.1F', 1.0)!='1.0') {
1180
+        if (sprintf('%.1F', 1.0) != '1.0') {
1181 1181
             $this->error('This version of PHP is not supported');
1182 1182
         }
1183 1183
         //Check mbstring overloading
@@ -1192,18 +1192,18 @@  discard block
 block discarded – undo
1192 1192
 
1193 1193
     protected function getpageformat($format)
1194 1194
     {
1195
-        $format=strtolower($format);
1195
+        $format = strtolower($format);
1196 1196
         if (!isset($this->pageFormats[$format])) {
1197
-            $this->error('Unknown page format: '.$format);
1197
+            $this->error('Unknown page format: ' . $format);
1198 1198
         }
1199
-        $a=$this->pageFormats[$format];
1200
-        return array($a[0]/$this->k, $a[1]/$this->k);
1199
+        $a = $this->pageFormats[$format];
1200
+        return array($a[0] / $this->k, $a[1] / $this->k);
1201 1201
     }
1202 1202
 
1203 1203
     protected function getFontPath()
1204 1204
     {
1205
-        if (!defined('FPDF_FONTPATH') && is_dir(dirname(__FILE__).'/font')) {
1206
-            define('FPDF_FONTPATH', dirname(__FILE__).'/font/');
1205
+        if (!defined('FPDF_FONTPATH') && is_dir(dirname(__FILE__) . '/font')) {
1206
+            define('FPDF_FONTPATH', dirname(__FILE__) . '/font/');
1207 1207
         }
1208 1208
         return defined('FPDF_FONTPATH') ? FPDF_FONTPATH : '';
1209 1209
     }
@@ -1226,12 +1226,12 @@  discard block
 block discarded – undo
1226 1226
             $format = $this->defPageFormat;
1227 1227
         } else {
1228 1228
             if (is_string($format)) {
1229
-                $format=$this->getpageformat($format);
1229
+                $format = $this->getpageformat($format);
1230 1230
             }
1231 1231
         }
1232 1232
         if ($orientation != $this->curOrientation
1233
-            || $format[0]!=$this->curPageFormat[0]
1234
-            || $format[1]!=$this->curPageFormat[1]
1233
+            || $format[0] != $this->curPageFormat[0]
1234
+            || $format[1] != $this->curPageFormat[1]
1235 1235
         ) {
1236 1236
             //New size
1237 1237
             if ($orientation == 'P') {
@@ -1241,9 +1241,9 @@  discard block
 block discarded – undo
1241 1241
                 $this->w = $format[1];
1242 1242
                 $this->h = $format[0];
1243 1243
             }
1244
-            $this->wPt = $this->w*$this->k;
1245
-            $this->hPt = $this->h*$this->k;
1246
-            $this->pageBreakTrigger = $this->h-$this->bMargin;
1244
+            $this->wPt = $this->w * $this->k;
1245
+            $this->hPt = $this->h * $this->k;
1246
+            $this->pageBreakTrigger = $this->h - $this->bMargin;
1247 1247
             $this->curOrientation = $orientation;
1248 1248
             $this->curPageFormat = $format;
1249 1249
         }
@@ -1273,7 +1273,7 @@  discard block
 block discarded – undo
1273 1273
     protected function textString($s)
1274 1274
     {
1275 1275
         //Format a text string
1276
-        return '('.$this->escape($s).')';
1276
+        return '(' . $this->escape($s) . ')';
1277 1277
     }
1278 1278
 
1279 1279
     protected function utf8Toutf16($s)
@@ -1288,16 +1288,16 @@  discard block
 block discarded – undo
1288 1288
                 //3-byte character
1289 1289
                 $c2 = ord($s[$i++]);
1290 1290
                 $c3 = ord($s[$i++]);
1291
-                $res .= chr((($c1 & 0x0F)<<4) + (($c2 & 0x3C)>>2));
1292
-                $res .= chr((($c2 & 0x03)<<6) + ($c3 & 0x3F));
1291
+                $res .= chr((($c1 & 0x0F) << 4) + (($c2 & 0x3C) >> 2));
1292
+                $res .= chr((($c2 & 0x03) << 6) + ($c3 & 0x3F));
1293 1293
             } elseif ($c1 >= 192) {
1294 1294
                 //2-byte character
1295 1295
                 $c2 = ord($s[$i++]);
1296
-                $res .= chr(($c1 & 0x1C)>>2);
1297
-                $res .= chr((($c1 & 0x03)<<6) + ($c2 & 0x3F));
1296
+                $res .= chr(($c1 & 0x1C) >> 2);
1297
+                $res .= chr((($c1 & 0x03) << 6) + ($c2 & 0x3F));
1298 1298
             } else {
1299 1299
                 //Single-byte character
1300
-                $res .= "\0".chr($c1);
1300
+                $res .= "\0" . chr($c1);
1301 1301
             }
1302 1302
         }
1303 1303
         return $res;
@@ -1308,13 +1308,13 @@  discard block
 block discarded – undo
1308 1308
         //Underline text
1309 1309
         $up = $this->currentFont['up'];
1310 1310
         $ut = $this->currentFont['ut'];
1311
-        $w = $this->getStringWidth($txt)+$this->ws*substr_count($txt, ' ');
1311
+        $w = $this->getStringWidth($txt) + $this->ws * substr_count($txt, ' ');
1312 1312
         return sprintf(
1313 1313
             '%.2F %.2F %.2F %.2F re f',
1314
-            $x*$this->k,
1315
-            ($this->h-($y-$up/1000*$this->fontSize))*$this->k,
1316
-            $w*$this->k,
1317
-            -$ut/1000*$this->fontSizePt
1314
+            $x * $this->k,
1315
+            ($this->h - ($y - $up / 1000 * $this->fontSize)) * $this->k,
1316
+            $w * $this->k,
1317
+            -$ut / 1000 * $this->fontSizePt
1318 1318
         );
1319 1319
     }
1320 1320
 
@@ -1323,17 +1323,17 @@  discard block
 block discarded – undo
1323 1323
         //Extract info from a JPEG file
1324 1324
         $a = getImageSize($file);
1325 1325
         if (!$a) {
1326
-            $this->error('Missing or incorrect image file: '.$file);
1326
+            $this->error('Missing or incorrect image file: ' . $file);
1327 1327
         }
1328
-        if ($a[2]!=2) {
1329
-            $this->error('Not a JPEG file: '.$file);
1328
+        if ($a[2] != 2) {
1329
+            $this->error('Not a JPEG file: ' . $file);
1330 1330
         }
1331 1331
         if (!isset($a['channels']) || $a['channels'] == 3) {
1332 1332
             $colspace = 'DeviceRGB';
1333 1333
         } elseif ($a['channels'] == 4) {
1334 1334
             $colspace = 'DeviceCMYK';
1335 1335
         } else {
1336
-            $colspace='DeviceGray';
1336
+            $colspace = 'DeviceGray';
1337 1337
         }
1338 1338
         $bpc = isset($a['bits']) ? $a['bits'] : 8;
1339 1339
         //Read whole file
@@ -1351,22 +1351,22 @@  discard block
 block discarded – undo
1351 1351
         //Extract info from a PNG file
1352 1352
         $f = fopen($file, 'rb');
1353 1353
         if (!$f) {
1354
-            $this->error('Can\'t open image file: '.$file);
1354
+            $this->error('Can\'t open image file: ' . $file);
1355 1355
         }
1356 1356
         //Check signature
1357
-        if ($this->readstream($f, 8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) {
1358
-            $this->error('Not a PNG file: '.$file);
1357
+        if ($this->readstream($f, 8) != chr(137) . 'PNG' . chr(13) . chr(10) . chr(26) . chr(10)) {
1358
+            $this->error('Not a PNG file: ' . $file);
1359 1359
         }
1360 1360
         //Read header chunk
1361 1361
         $this->readstream($f, 4);
1362
-        if ($this->readstream($f, 4)!='IHDR') {
1363
-            $this->error('Incorrect PNG file: '.$file);
1362
+        if ($this->readstream($f, 4) != 'IHDR') {
1363
+            $this->error('Incorrect PNG file: ' . $file);
1364 1364
         }
1365 1365
         $w = $this->readint($f);
1366 1366
         $h = $this->readint($f);
1367 1367
         $bpc = ord($this->readstream($f, 1));
1368
-        if ($bpc>8) {
1369
-            $this->error('16-bit depth not supported: '.$file);
1368
+        if ($bpc > 8) {
1369
+            $this->error('16-bit depth not supported: ' . $file);
1370 1370
         }
1371 1371
         $ct = ord($this->readstream($f, 1));
1372 1372
         if ($ct == 0) {
@@ -1376,20 +1376,20 @@  discard block
 block discarded – undo
1376 1376
         } elseif ($ct == 3) {
1377 1377
             $colspace = 'Indexed';
1378 1378
         } else {
1379
-            $this->error('Alpha channel not supported: '.$file);
1379
+            $this->error('Alpha channel not supported: ' . $file);
1380 1380
         }
1381 1381
         if (ord($this->readstream($f, 1)) != 0) {
1382
-            $this->error('Unknown compression method: '.$file);
1382
+            $this->error('Unknown compression method: ' . $file);
1383 1383
         }
1384 1384
         if (ord($this->readstream($f, 1)) != 0) {
1385
-            $this->error('Unknown filter method: '.$file);
1385
+            $this->error('Unknown filter method: ' . $file);
1386 1386
         }
1387 1387
         if (ord($this->readstream($f, 1)) != 0) {
1388
-            $this->error('Interlacing not supported: '.$file);
1388
+            $this->error('Interlacing not supported: ' . $file);
1389 1389
         }
1390 1390
         $this->readstream($f, 4);
1391 1391
         $parms = '/DecodeParms <</Predictor 15 /Colors '
1392
-            . ($ct==2 ? 3 : 1)
1392
+            . ($ct == 2 ? 3 : 1)
1393 1393
             . ' /BitsPerComponent '
1394 1394
             . $bpc
1395 1395
             . ' /Columns '
@@ -1427,11 +1427,11 @@  discard block
 block discarded – undo
1427 1427
             } elseif ($type == 'IEND') {
1428 1428
                 break;
1429 1429
             } else {
1430
-                $this->readstream($f, $n+4);
1430
+                $this->readstream($f, $n + 4);
1431 1431
             }
1432 1432
         } while ($n);
1433 1433
         if ($colspace == 'Indexed' && empty($pal)) {
1434
-            $this->error('Missing palette in '.$file);
1434
+            $this->error('Missing palette in ' . $file);
1435 1435
         }
1436 1436
         fclose($f);
1437 1437
         return [
@@ -1450,9 +1450,9 @@  discard block
 block discarded – undo
1450 1450
     protected function readstream($f, $n)
1451 1451
     {
1452 1452
         //Read n bytes from stream
1453
-        $res='';
1453
+        $res = '';
1454 1454
         while ($n > 0 && !feof($f)) {
1455
-            $s=fread($f, $n);
1455
+            $s = fread($f, $n);
1456 1456
             if ($s === false) {
1457 1457
                 $this->error('Error while reading stream');
1458 1458
             }
@@ -1483,7 +1483,7 @@  discard block
 block discarded – undo
1483 1483
         }
1484 1484
         $im = imagecreatefromgif($file);
1485 1485
         if (!$im) {
1486
-            $this->error('Missing or incorrect image file: '.$file);
1486
+            $this->error('Missing or incorrect image file: ' . $file);
1487 1487
         }
1488 1488
         imageinterlace($im, 0);
1489 1489
         $tmp = tempnam('.', 'gif');
@@ -1494,7 +1494,7 @@  discard block
 block discarded – undo
1494 1494
             $this->error('Error while saving to temporary file');
1495 1495
         }
1496 1496
         imagedestroy($im);
1497
-        $info=$this->parsePNG($tmp);
1497
+        $info = $this->parsePNG($tmp);
1498 1498
         unlink($tmp);
1499 1499
         return $info;
1500 1500
     }
@@ -1504,7 +1504,7 @@  discard block
 block discarded – undo
1504 1504
         //Begin a new object
1505 1505
         $this->n++;
1506 1506
         $this->offsets[$this->n] = strlen($this->buffer);
1507
-        $this->out($this->n.' 0 obj');
1507
+        $this->out($this->n . ' 0 obj');
1508 1508
     }
1509 1509
 
1510 1510
     protected function putStream($s)
@@ -1518,9 +1518,9 @@  discard block
 block discarded – undo
1518 1518
     {
1519 1519
         //Add a line to the document
1520 1520
         if ($this->state == 2) {
1521
-            $this->pages[$this->page].=$s."\n";
1521
+            $this->pages[$this->page] .= $s . "\n";
1522 1522
         } else {
1523
-            $this->buffer .= $s."\n";
1523
+            $this->buffer .= $s . "\n";
1524 1524
         }
1525 1525
     }
1526 1526
 
@@ -1529,19 +1529,19 @@  discard block
 block discarded – undo
1529 1529
         $nb = $this->page;
1530 1530
         if (!empty($this->aliasNbPages)) {
1531 1531
             //Replace number of pages
1532
-            for ($n=1; $n<=$nb; $n++) {
1532
+            for ($n = 1; $n <= $nb; $n++) {
1533 1533
                 $this->pages[$n] = str_replace($this->aliasNbPages, $nb, $this->pages[$n]);
1534 1534
             }
1535 1535
         }
1536 1536
         if ($this->defOrientation == 'P') {
1537
-            $wPt = $this->defPageFormat[0]*$this->k;
1538
-            $hPt = $this->defPageFormat[1]*$this->k;
1537
+            $wPt = $this->defPageFormat[0] * $this->k;
1538
+            $hPt = $this->defPageFormat[1] * $this->k;
1539 1539
         } else {
1540
-            $wPt = $this->defPageFormat[1]*$this->k;
1541
-            $hPt = $this->defPageFormat[0]*$this->k;
1540
+            $wPt = $this->defPageFormat[1] * $this->k;
1541
+            $hPt = $this->defPageFormat[0] * $this->k;
1542 1542
         }
1543 1543
         $filter = ($this->compress) ? '/Filter /FlateDecode ' : '';
1544
-        for ($n=1; $n<=$nb; $n++) {
1544
+        for ($n = 1; $n <= $nb; $n++) {
1545 1545
             //Page
1546 1546
             $this->newObj();
1547 1547
             $this->out('<</Type /Page');
@@ -1554,37 +1554,37 @@  discard block
 block discarded – undo
1554 1554
                 //Links
1555 1555
                 $annots = '/Annots [';
1556 1556
                 foreach ($this->PageLinks[$n] as $pl) {
1557
-                    $rect = sprintf('%.2F %.2F %.2F %.2F', $pl[0], $pl[1], $pl[0]+$pl[2], $pl[1]-$pl[3]);
1558
-                    $annots .= '<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] ';
1557
+                    $rect = sprintf('%.2F %.2F %.2F %.2F', $pl[0], $pl[1], $pl[0] + $pl[2], $pl[1] - $pl[3]);
1558
+                    $annots .= '<</Type /Annot /Subtype /Link /Rect [' . $rect . '] /Border [0 0 0] ';
1559 1559
                     if (is_string($pl[4])) {
1560
-                        $annots .= '/A <</S /URI /URI '.$this->textString($pl[4]).'>>>>';
1560
+                        $annots .= '/A <</S /URI /URI ' . $this->textString($pl[4]) . '>>>>';
1561 1561
                     } else {
1562 1562
                         $l = $this->links[$pl[4]];
1563 1563
                         $h = isset($this->PageSizes[$l[0]]) ? $this->PageSizes[$l[0]][1] : $hPt;
1564
-                        $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>', 1+2*$l[0], $h-$l[1]*$this->k);
1564
+                        $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>', 1 + 2 * $l[0], $h - $l[1] * $this->k);
1565 1565
                     }
1566 1566
                 }
1567
-                $this->out($annots.']');
1567
+                $this->out($annots . ']');
1568 1568
             }
1569
-            $this->out('/Contents '.($this->n+1).' 0 R>>');
1569
+            $this->out('/Contents ' . ($this->n + 1) . ' 0 R>>');
1570 1570
             $this->out('endobj');
1571 1571
             //Page content
1572
-            $p=($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n];
1572
+            $p = ($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n];
1573 1573
             $this->newObj();
1574
-            $this->out('<<'.$filter.'/Length '.strlen($p).'>>');
1574
+            $this->out('<<' . $filter . '/Length ' . strlen($p) . '>>');
1575 1575
             $this->putStream($p);
1576 1576
             $this->out('endobj');
1577 1577
         }
1578 1578
         //Pages root
1579
-        $this->offsets[1]=strlen($this->buffer);
1579
+        $this->offsets[1] = strlen($this->buffer);
1580 1580
         $this->out('1 0 obj');
1581 1581
         $this->out('<</Type /Pages');
1582 1582
         $kids = '/Kids [';
1583
-        for ($i=0; $i<$nb; $i++) {
1584
-            $kids .= (3+2*$i).' 0 R ';
1583
+        for ($i = 0; $i < $nb; $i++) {
1584
+            $kids .= (3 + 2 * $i) . ' 0 R ';
1585 1585
         }
1586
-        $this->out($kids.']');
1587
-        $this->out('/Count '.$nb);
1586
+        $this->out($kids . ']');
1587
+        $this->out('/Count ' . $nb);
1588 1588
         $this->out(sprintf('/MediaBox [0 0 %.2F %.2F]', $wPt, $hPt));
1589 1589
         $this->out('>>');
1590 1590
         $this->out('endobj');
@@ -1596,41 +1596,41 @@  discard block
 block discarded – undo
1596 1596
         foreach ($this->diffs as $diff) {
1597 1597
             //Encodings
1598 1598
             $this->newObj();
1599
-            $this->out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.']>>');
1599
+            $this->out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences [' . $diff . ']>>');
1600 1600
             $this->out('endobj');
1601 1601
         }
1602 1602
         foreach ($this->fontFiles as $file => $info) {
1603 1603
             //Font file embedding
1604 1604
             $this->newObj();
1605
-            $this->fontFiles[$file]['n']=$this->n;
1606
-            $font='';
1607
-            $f = fopen($this->getFontPath().$file, 'rb', 1);
1605
+            $this->fontFiles[$file]['n'] = $this->n;
1606
+            $font = '';
1607
+            $f = fopen($this->getFontPath() . $file, 'rb', 1);
1608 1608
             if (!$f) {
1609 1609
                 $this->error('Font file not found');
1610 1610
             }
1611 1611
             while (!feof($f)) {
1612
-                $font.=fread($f, 8192);
1612
+                $font .= fread($f, 8192);
1613 1613
             }
1614 1614
             fclose($f);
1615
-            $compressed = (substr($file, -2)=='.z');
1615
+            $compressed = (substr($file, -2) == '.z');
1616 1616
             if (!$compressed && isset($info['length2'])) {
1617
-                $header = (ord($font[0])==128);
1617
+                $header = (ord($font[0]) == 128);
1618 1618
                 if ($header) {
1619 1619
                     //Strip first binary header
1620 1620
                     $font = substr($font, 6);
1621 1621
                 }
1622 1622
                 if ($header && ord($font[$info['length1']]) == 128) {
1623 1623
                     //Strip second binary header
1624
-                    $font = substr($font, 0, $info['length1']).substr($font, $info['length1']+6);
1624
+                    $font = substr($font, 0, $info['length1']) . substr($font, $info['length1'] + 6);
1625 1625
                 }
1626 1626
             }
1627
-            $this->out('<</Length '.strlen($font));
1627
+            $this->out('<</Length ' . strlen($font));
1628 1628
             if ($compressed) {
1629 1629
                 $this->out('/Filter /FlateDecode');
1630 1630
             }
1631
-            $this->out('/Length1 '.$info['length1']);
1631
+            $this->out('/Length1 ' . $info['length1']);
1632 1632
             if (isset($info['length2'])) {
1633
-                $this->out('/Length2 '.$info['length2'].' /Length3 0');
1633
+                $this->out('/Length2 ' . $info['length2'] . ' /Length3 0');
1634 1634
             }
1635 1635
             $this->out('>>');
1636 1636
             $this->putStream($font);
@@ -1638,32 +1638,32 @@  discard block
 block discarded – undo
1638 1638
         }
1639 1639
         foreach ($this->fonts as $k => $font) {
1640 1640
             //Font objects
1641
-            $this->fonts[$k]['n']=$this->n+1;
1641
+            $this->fonts[$k]['n'] = $this->n + 1;
1642 1642
             $type = $font['type'];
1643 1643
             $name = $font['name'];
1644 1644
             if ($type == 'core') {
1645 1645
                 //Standard font
1646 1646
                 $this->newObj();
1647 1647
                 $this->out('<</Type /Font');
1648
-                $this->out('/BaseFont /'.$name);
1648
+                $this->out('/BaseFont /' . $name);
1649 1649
                 $this->out('/Subtype /Type1');
1650 1650
                 if ($name != 'Symbol' && $name != 'ZapfDingbats') {
1651 1651
                     $this->out('/Encoding /WinAnsiEncoding');
1652 1652
                 }
1653 1653
                 $this->out('>>');
1654 1654
                 $this->out('endobj');
1655
-            } elseif ($type=='Type1' || $type=='TrueType') {
1655
+            } elseif ($type == 'Type1' || $type == 'TrueType') {
1656 1656
                 //Additional Type1 or TrueType font
1657 1657
                 $this->newObj();
1658 1658
                 $this->out('<</Type /Font');
1659
-                $this->out('/BaseFont /'.$name);
1660
-                $this->out('/Subtype /'.$type);
1659
+                $this->out('/BaseFont /' . $name);
1660
+                $this->out('/Subtype /' . $type);
1661 1661
                 $this->out('/FirstChar 32 /LastChar 255');
1662
-                $this->out('/Widths '.($this->n+1).' 0 R');
1663
-                $this->out('/FontDescriptor '.($this->n+2).' 0 R');
1662
+                $this->out('/Widths ' . ($this->n + 1) . ' 0 R');
1663
+                $this->out('/FontDescriptor ' . ($this->n + 2) . ' 0 R');
1664 1664
                 if ($font['enc']) {
1665 1665
                     if (isset($font['diff'])) {
1666
-                        $this->out('/Encoding '.($nf+$font['diff']).' 0 R');
1666
+                        $this->out('/Encoding ' . ($nf + $font['diff']) . ' 0 R');
1667 1667
                     } else {
1668 1668
                         $this->out('/Encoding /WinAnsiEncoding');
1669 1669
                     }
@@ -1672,30 +1672,30 @@  discard block
 block discarded – undo
1672 1672
                 $this->out('endobj');
1673 1673
                 //Widths
1674 1674
                 $this->newObj();
1675
-                $cw =& $font['cw'];
1675
+                $cw = & $font['cw'];
1676 1676
                 $s = '[';
1677
-                for ($i=32; $i<=255; $i++) {
1678
-                    $s .= $cw[chr($i)].' ';
1677
+                for ($i = 32; $i <= 255; $i++) {
1678
+                    $s .= $cw[chr($i)] . ' ';
1679 1679
                 }
1680
-                $this->out($s.']');
1680
+                $this->out($s . ']');
1681 1681
                 $this->out('endobj');
1682 1682
                 //Descriptor
1683 1683
                 $this->newObj();
1684
-                $s='<</Type /FontDescriptor /FontName /'.$name;
1684
+                $s = '<</Type /FontDescriptor /FontName /' . $name;
1685 1685
                 foreach ($font['desc'] as $k => $v) {
1686
-                    $s .= ' /'.$k.' '.$v;
1686
+                    $s .= ' /' . $k . ' ' . $v;
1687 1687
                 }
1688
-                $file=$font['file'];
1688
+                $file = $font['file'];
1689 1689
                 if ($file) {
1690
-                    $s .= ' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->fontFiles[$file]['n'].' 0 R';
1690
+                    $s .= ' /FontFile' . ($type == 'Type1' ? '' : '2') . ' ' . $this->fontFiles[$file]['n'] . ' 0 R';
1691 1691
                 }
1692
-                $this->out($s.'>>');
1692
+                $this->out($s . '>>');
1693 1693
                 $this->out('endobj');
1694 1694
             } else {
1695 1695
                 //Allow for additional types
1696
-                $mtd='_put'.strtolower($type);
1696
+                $mtd = '_put' . strtolower($type);
1697 1697
                 if (!method_exists($this, $mtd)) {
1698
-                    $this->error('Unsupported font type: '.$type);
1698
+                    $this->error('Unsupported font type: ' . $type);
1699 1699
                 }
1700 1700
                 $this->$mtd($font);
1701 1701
             }
@@ -1706,44 +1706,44 @@  discard block
 block discarded – undo
1706 1706
     {
1707 1707
         $filter = ($this->compress) ? '/Filter /FlateDecode ' : '';
1708 1708
         reset($this->images);
1709
-        while (list($file,$info) = each($this->images)) {
1709
+        while (list($file, $info) = each($this->images)) {
1710 1710
             $this->newObj();
1711 1711
             $this->images[$file]['n'] = $this->n;
1712 1712
             $this->out('<</Type /XObject');
1713 1713
             $this->out('/Subtype /Image');
1714
-            $this->out('/Width '.$info['w']);
1715
-            $this->out('/Height '.$info['h']);
1716
-            if ($info['cs']=='Indexed') {
1717
-                $this->out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]');
1714
+            $this->out('/Width ' . $info['w']);
1715
+            $this->out('/Height ' . $info['h']);
1716
+            if ($info['cs'] == 'Indexed') {
1717
+                $this->out('/ColorSpace [/Indexed /DeviceRGB ' . (strlen($info['pal']) / 3 - 1) . ' ' . ($this->n + 1) . ' 0 R]');
1718 1718
             } else {
1719
-                $this->out('/ColorSpace /'.$info['cs']);
1720
-                if ($info['cs']=='DeviceCMYK') {
1719
+                $this->out('/ColorSpace /' . $info['cs']);
1720
+                if ($info['cs'] == 'DeviceCMYK') {
1721 1721
                     $this->out('/Decode [1 0 1 0 1 0 1 0]');
1722 1722
                 }
1723 1723
             }
1724
-            $this->out('/BitsPerComponent '.$info['bpc']);
1724
+            $this->out('/BitsPerComponent ' . $info['bpc']);
1725 1725
             if (isset($info['f'])) {
1726
-                $this->out('/Filter /'.$info['f']);
1726
+                $this->out('/Filter /' . $info['f']);
1727 1727
             }
1728 1728
             if (isset($info['parms'])) {
1729 1729
                 $this->out($info['parms']);
1730 1730
             }
1731 1731
             if (isset($info['trns']) && is_array($info['trns'])) {
1732 1732
                 $trns = '';
1733
-                for ($i=0; $i<count($info['trns']); $i++) {
1734
-                    $trns.=$info['trns'][$i].' '.$info['trns'][$i].' ';
1733
+                for ($i = 0; $i < count($info['trns']); $i++) {
1734
+                    $trns .= $info['trns'][$i] . ' ' . $info['trns'][$i] . ' ';
1735 1735
                 }
1736
-                $this->out('/Mask ['.$trns.']');
1736
+                $this->out('/Mask [' . $trns . ']');
1737 1737
             }
1738
-            $this->out('/Length '.strlen($info['data']).'>>');
1738
+            $this->out('/Length ' . strlen($info['data']) . '>>');
1739 1739
             $this->putStream($info['data']);
1740 1740
             unset($this->images[$file]['data']);
1741 1741
             $this->out('endobj');
1742 1742
             //Palette
1743 1743
             if ($info['cs'] == 'Indexed') {
1744 1744
                 $this->newObj();
1745
-                $pal=($this->compress) ? gzcompress($info['pal']) : $info['pal'];
1746
-                $this->out('<<'.$filter.'/Length '.strlen($pal).'>>');
1745
+                $pal = ($this->compress) ? gzcompress($info['pal']) : $info['pal'];
1746
+                $this->out('<<' . $filter . '/Length ' . strlen($pal) . '>>');
1747 1747
                 $this->putStream($pal);
1748 1748
                 $this->out('endobj');
1749 1749
             }
@@ -1753,7 +1753,7 @@  discard block
 block discarded – undo
1753 1753
     protected function putXobjectDict()
1754 1754
     {
1755 1755
         foreach ($this->images as $image) {
1756
-            $this->out('/I'.$image['i'].' '.$image['n'].' 0 R');
1756
+            $this->out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R');
1757 1757
         }
1758 1758
     }
1759 1759
 
@@ -1762,7 +1762,7 @@  discard block
 block discarded – undo
1762 1762
         $this->out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
1763 1763
         $this->out('/Font <<');
1764 1764
         foreach ($this->fonts as $font) {
1765
-            $this->out('/F'.$font['i'].' '.$font['n'].' 0 R');
1765
+            $this->out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R');
1766 1766
         }
1767 1767
         $this->out('>>');
1768 1768
         $this->out('/XObject <<');
@@ -1785,57 +1785,57 @@  discard block
 block discarded – undo
1785 1785
 
1786 1786
     protected function putInfo()
1787 1787
     {
1788
-        $this->out('/Producer '.$this->textString('FPDF '. self::FPDF_VERSION));
1788
+        $this->out('/Producer ' . $this->textString('FPDF ' . self::FPDF_VERSION));
1789 1789
         if (!empty($this->title)) {
1790
-            $this->out('/Title '.$this->textString($this->title));
1790
+            $this->out('/Title ' . $this->textString($this->title));
1791 1791
         }
1792 1792
         if (!empty($this->subject)) {
1793
-            $this->out('/Subject '.$this->textString($this->subject));
1793
+            $this->out('/Subject ' . $this->textString($this->subject));
1794 1794
         }
1795 1795
         if (!empty($this->author)) {
1796
-            $this->out('/Author '.$this->textString($this->author));
1796
+            $this->out('/Author ' . $this->textString($this->author));
1797 1797
         }
1798 1798
         if (!empty($this->keywords)) {
1799
-            $this->out('/Keywords '.$this->textString($this->keywords));
1799
+            $this->out('/Keywords ' . $this->textString($this->keywords));
1800 1800
         }
1801 1801
         if (!empty($this->creator)) {
1802
-            $this->out('/Creator '.$this->textString($this->creator));
1802
+            $this->out('/Creator ' . $this->textString($this->creator));
1803 1803
         }
1804
-        $this->out('/CreationDate '.$this->textString('D:'.@date('YmdHis')));
1804
+        $this->out('/CreationDate ' . $this->textString('D:' . @date('YmdHis')));
1805 1805
     }
1806 1806
 
1807 1807
     protected function putCatalog()
1808 1808
     {
1809 1809
         $this->out('/Type /Catalog');
1810 1810
         $this->out('/Pages 1 0 R');
1811
-        if ($this->zoomMode=='fullpage') {
1811
+        if ($this->zoomMode == 'fullpage') {
1812 1812
             $this->out('/OpenAction [3 0 R /Fit]');
1813
-        } elseif ($this->zoomMode=='fullwidth') {
1813
+        } elseif ($this->zoomMode == 'fullwidth') {
1814 1814
             $this->out('/OpenAction [3 0 R /FitH null]');
1815
-        } elseif ($this->zoomMode=='real') {
1815
+        } elseif ($this->zoomMode == 'real') {
1816 1816
             $this->out('/OpenAction [3 0 R /XYZ null null 1]');
1817 1817
         } elseif (!is_string($this->zoomMode)) {
1818
-            $this->out('/OpenAction [3 0 R /XYZ null null '.($this->zoomMode/100).']');
1818
+            $this->out('/OpenAction [3 0 R /XYZ null null ' . ($this->zoomMode / 100) . ']');
1819 1819
         }
1820
-        if ($this->layoutMode=='single') {
1820
+        if ($this->layoutMode == 'single') {
1821 1821
             $this->out('/PageLayout /SinglePage');
1822
-        } elseif ($this->layoutMode=='continuous') {
1822
+        } elseif ($this->layoutMode == 'continuous') {
1823 1823
             $this->out('/PageLayout /OneColumn');
1824
-        } elseif ($this->layoutMode=='two') {
1824
+        } elseif ($this->layoutMode == 'two') {
1825 1825
             $this->out('/PageLayout /TwoColumnLeft');
1826 1826
         }
1827 1827
     }
1828 1828
 
1829 1829
     protected function putHeader()
1830 1830
     {
1831
-        $this->out('%PDF-'.$this->pdfVersion);
1831
+        $this->out('%PDF-' . $this->pdfVersion);
1832 1832
     }
1833 1833
 
1834 1834
     protected function putTrailer()
1835 1835
     {
1836
-        $this->out('/Size '.($this->n+1));
1837
-        $this->out('/Root '.$this->n.' 0 R');
1838
-        $this->out('/Info '.($this->n-1).' 0 R');
1836
+        $this->out('/Size ' . ($this->n + 1));
1837
+        $this->out('/Root ' . $this->n . ' 0 R');
1838
+        $this->out('/Info ' . ($this->n - 1) . ' 0 R');
1839 1839
     }
1840 1840
 
1841 1841
     protected function endDoc()
@@ -1856,11 +1856,11 @@  discard block
 block discarded – undo
1856 1856
         $this->out('>>');
1857 1857
         $this->out('endobj');
1858 1858
         //Cross-ref
1859
-        $o=strlen($this->buffer);
1859
+        $o = strlen($this->buffer);
1860 1860
         $this->out('xref');
1861
-        $this->out('0 '.($this->n+1));
1861
+        $this->out('0 ' . ($this->n + 1));
1862 1862
         $this->out('0000000000 65535 f ');
1863
-        for ($i=1; $i<=$this->n; $i++) {
1863
+        for ($i = 1; $i <= $this->n; $i++) {
1864 1864
             $this->out(sprintf('%010d 00000 n ', $this->offsets[$i]));
1865 1865
         }
1866 1866
         //Trailer
@@ -1871,6 +1871,6 @@  discard block
 block discarded – undo
1871 1871
         $this->out('startxref');
1872 1872
         $this->out($o);
1873 1873
         $this->out('%%EOF');
1874
-        $this->state=3;
1874
+        $this->state = 3;
1875 1875
     }
1876 1876
 }
Please login to merge, or discard this patch.
src/Legacy/Dom.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         if (substr($xmlString, 0, 1) != '<') {
36 36
             throw new InvalidArgumentException($msg);
37 37
         }
38
-        if (! $this->loadXML($xmlString, LIBXML_NOBLANKS | LIBXML_NOEMPTYTAG)) {
38
+        if (!$this->loadXML($xmlString, LIBXML_NOBLANKS | LIBXML_NOEMPTYTAG)) {
39 39
             throw new InvalidArgumentException($msg);
40 40
         }
41 41
     }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         if (empty($node)) {
77 77
             return '';
78 78
         }
79
-        $texto = ! empty($node->getElementsByTagName($name)->item(0)->nodeValue) ?
79
+        $texto = !empty($node->getElementsByTagName($name)->item(0)->nodeValue) ?
80 80
             $node->getElementsByTagName($name)->item(0)->nodeValue : '';
81 81
         return html_entity_decode($texto, ENT_QUOTES, 'UTF-8');
82 82
     }
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
     public function getChave($nodeName = 'infNFe')
106 106
     {
107 107
         $node = $this->getElementsByTagName($nodeName)->item(0);
108
-        if (! empty($node)) {
108
+        if (!empty($node)) {
109 109
             $chaveId = $node->getAttribute("Id");
110
-            $chave =  preg_replace('/[^0-9]/', '', $chaveId);
110
+            $chave = preg_replace('/[^0-9]/', '', $chaveId);
111 111
             return $chave;
112 112
         }
113 113
         return '';
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     public function addArrayChild(&$parent, $arr)
198 198
     {
199 199
         $num = 0;
200
-        if (! empty($arr) && ! empty($parent)) {
200
+        if (!empty($arr) && !empty($parent)) {
201 201
             foreach ($arr as $node) {
202 202
                 $this->appChild($parent, $node, '');
203 203
                 $num++;
Please login to merge, or discard this patch.
src/CTe/Dacce.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -302,12 +302,12 @@  discard block
 block discarded – undo
302 302
             $tw = $w;
303 303
         }
304 304
         // Nome emitente
305
-        $aFont = ['font' => $this->fontePadrao,'size' => 12,'style' => 'B'];
305
+        $aFont = ['font' => $this->fontePadrao, 'size' => 12, 'style' => 'B'];
306 306
         $texto = $this->aEnd['razao'];
307 307
         $this->pTextBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
308 308
         // endereço
309 309
         $y1 = $y1 + 6;
310
-        $aFont = ['font' => $this->fontePadrao,'size' => 8,'style' => ''];
310
+        $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
311 311
         $lgr = $this->aEnd['logradouro'];
312 312
         $nro = $this->aEnd['numero'];
313 313
         $cpl = $this->aEnd['complemento'];
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
         $x += $w;
338 338
         $this->pTextBox($x, $y, $w2, $h);
339 339
         $y1 = $y + $h;
340
-        $aFont = ['font' => $this->fontePadrao,'size' => 16,'style' => 'B'];
340
+        $aFont = ['font' => $this->fontePadrao, 'size' => 16, 'style' => 'B'];
341 341
         $this->pTextBox($x, $y + 2, $w2, 8, 'Representação Gráfica de CC-e', $aFont, 'T', 'C', 0, '');
342 342
         $aFont = array(
343 343
             'font' => $this->fontePadrao,
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
         );
347 347
         $this->pTextBox($x, $y + 7, $w2, 8, '(Carta de Correção Eletrônica)', $aFont, 'T', 'C', 0, '');
348 348
         $texto = 'ID do Evento: ' . $this->id;
349
-        $aFont = ['font' => $this->fontePadrao,'size' => 10,'style' => ''];
349
+        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => ''];
350 350
         $this->pTextBox($x, $y + 15, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
351 351
         $tsHora = $this->pConvertTime($this->dhEvento);
352 352
         $texto = 'Criado em : ' . date('d/m/Y   H:i:s', $tsHora);
@@ -358,9 +358,9 @@  discard block
 block discarded – undo
358 358
         $x = $oldX;
359 359
         $this->pTextBox($x, $y1, $maxW, 40);
360 360
         $sY = $y1 + 40;
361
-        $texto = 'De acordo com as determinações legais vigentes, vimos por meio desta comunicar-lhe'.
361
+        $texto = 'De acordo com as determinações legais vigentes, vimos por meio desta comunicar-lhe' .
362 362
             ' que o Conhecimento, abaixo referenciada, contêm irregularidades que estão destacadas e' .
363
-            ' suas respectivas correções, solicitamos que sejam aplicadas essas correções ao executar'.
363
+            ' suas respectivas correções, solicitamos que sejam aplicadas essas correções ao executar' .
364 364
             ' seus lançamentos fiscais.';
365 365
         $aFont = array(
366 366
             'font' => $this->fontePadrao,
@@ -446,10 +446,10 @@  discard block
 block discarded – undo
446 446
             'size' => 9,
447 447
             'style' => 'B'
448 448
         );
449
-        $this->pTextBox($x, $y, $maxW = ($maxW/5), 5, "Grupo", $aFont, 'T', 'C', 0, '', false);
449
+        $this->pTextBox($x, $y, $maxW = ($maxW / 5), 5, "Grupo", $aFont, 'T', 'C', 0, '', false);
450 450
         $this->pTextBox($x = $maxW, $y, $maxW, 5, "Campo", $aFont, 'T', 'C', 0, '', false);
451
-        $this->pTextBox($x = ($maxW*2), $y, $maxW, 5, "Número", $aFont, 'T', 'C', 0, '', false);
452
-        $this->pTextBox($x = ($maxW*3), $y, ($this->wPrint-$x), 5, "Valor", $aFont, 'T', 'C', 0, '', false);
451
+        $this->pTextBox($x = ($maxW * 2), $y, $maxW, 5, "Número", $aFont, 'T', 'C', 0, '', false);
452
+        $this->pTextBox($x = ($maxW * 3), $y, ($this->wPrint - $x), 5, "Valor", $aFont, 'T', 'C', 0, '', false);
453 453
         
454 454
         $aFont = array(
455 455
             'font' => $this->fontePadrao,
@@ -457,11 +457,11 @@  discard block
 block discarded – undo
457 457
             'style' => ''
458 458
         );
459 459
         //Correções
460
-        $i=0;
460
+        $i = 0;
461 461
         $numlinhas = 1;
462 462
         while ($i < $this->infCorrecao->length) {
463 463
             $x = 0;
464
-            $y = $numlinhas == 1 ? ($y+5) : ($y+(5*$numlinhas));
464
+            $y = $numlinhas == 1 ? ($y + 5) : ($y + (5 * $numlinhas));
465 465
             $maxW = $this->wPrint;
466 466
             $grupo = $this->infCorrecao->item($i)->getElementsByTagName('grupoAlterado')->item(0)->nodeValue;
467 467
             $campo = $this->infCorrecao->item($i)->getElementsByTagName('campoAlterado')->item(0)->nodeValue;
@@ -469,11 +469,11 @@  discard block
 block discarded – undo
469 469
             $valor = $this->infCorrecao->item($i)->getElementsByTagName('valorAlterado')->item(0)->nodeValue;
470 470
                                     
471 471
             $i++;
472
-            $this->pTextBox($x, $y, $maxW = ($maxW/5), 5, $grupo, $aFont, 'T', 'C', 0, '', false);
472
+            $this->pTextBox($x, $y, $maxW = ($maxW / 5), 5, $grupo, $aFont, 'T', 'C', 0, '', false);
473 473
             $this->pTextBox($x = $maxW, $y, $maxW, 5, $campo, $aFont, 'T', 'C', 0, '', false);
474
-            $this->pTextBox($x = ($maxW*2), $y, $maxW, 5, $numero, $aFont, 'T', 'C', 0, '', false);
475
-            $this->pTextBox($x = ($maxW*3), $y, ($this->wPrint-$x), 5, $valor, $aFont, 'T', 'C', 0, '', false);
476
-            $numlinhas = $this->pGetNumLines($valor, ($this->wPrint-$x), $aFont);
474
+            $this->pTextBox($x = ($maxW * 2), $y, $maxW, 5, $numero, $aFont, 'T', 'C', 0, '', false);
475
+            $this->pTextBox($x = ($maxW * 3), $y, ($this->wPrint - $x), 5, $valor, $aFont, 'T', 'C', 0, '', false);
476
+            $numlinhas = $this->pGetNumLines($valor, ($this->wPrint - $x), $aFont);
477 477
         } //fim da soma das areas de itens usadas
478 478
                         
479 479
         
Please login to merge, or discard this patch.
src/CTe/Daevento.php 1 patch
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -134,28 +134,28 @@  discard block
 block discarded – undo
134 134
         $this->rinfEvento       = $this->retEvento->getElementsByTagName("infEvento")->item(0);
135 135
         $this->tpEvento         = $this->infEvento->getElementsByTagName("tpEvento")->item(0)->nodeValue;
136 136
         if (!in_array($this->tpEvento, array('110110', '110111'))) {
137
-            $this->errMsg = 'Evento não implementado '.$tpEvento.' !!';
137
+            $this->errMsg = 'Evento não implementado ' . $tpEvento . ' !!';
138 138
             $this->errStatus = true;
139 139
             return false;
140 140
         }
141 141
         $this->id = str_replace('ID', '', $this->infEvento->getAttribute("Id"));
142 142
         $this->chCTe = $this->infEvento->getElementsByTagName("chCTe")->item(0)->nodeValue;
143
-        $this->aEnd['CNPJ']=substr($this->chCTe, 6, 14);
143
+        $this->aEnd['CNPJ'] = substr($this->chCTe, 6, 14);
144 144
         $this->tpAmb = $this->infEvento->getElementsByTagName("tpAmb")->item(0)->nodeValue;
145 145
         $this->cOrgao = $this->infEvento->getElementsByTagName("cOrgao")->item(0)->nodeValue;
146 146
         $this->xCorrecao = $this->infEvento->getElementsByTagName("xCorrecao")->item(0);
147
-        $this->xCorrecao=(empty($this->xCorrecao)?'':$this->xCorrecao->nodeValue);
147
+        $this->xCorrecao = (empty($this->xCorrecao) ? '' : $this->xCorrecao->nodeValue);
148 148
         $this->xCondUso = $this->infEvento->getElementsByTagName("xCondUso")->item(0);
149
-        $this->xCondUso=(empty($this->xCondUso)?'':$this->xCondUso->nodeValue);
150
-        $this->xJust =  $this->infEvento->getElementsByTagName("xJust")->item(0);
151
-        $this->xJust=(empty($this->xJust)?'':$this->xJust->nodeValue);
149
+        $this->xCondUso = (empty($this->xCondUso) ? '' : $this->xCondUso->nodeValue);
150
+        $this->xJust = $this->infEvento->getElementsByTagName("xJust")->item(0);
151
+        $this->xJust = (empty($this->xJust) ? '' : $this->xJust->nodeValue);
152 152
         $this->dhEvento = $this->infEvento->getElementsByTagName("dhEvento")->item(0)->nodeValue;
153 153
         $this->cStat = $this->rinfEvento->getElementsByTagName("cStat")->item(0)->nodeValue;
154 154
         $this->xMotivo = $this->rinfEvento->getElementsByTagName("xMotivo")->item(0)->nodeValue;
155
-        $this->CNPJDest = !empty($this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue)?
156
-                $this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue:'';
157
-        $this->CPFDest =  !empty($this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue)?
158
-                $this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue:'';
155
+        $this->CNPJDest = !empty($this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue) ?
156
+                $this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue : '';
157
+        $this->CPFDest = !empty($this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue) ?
158
+                $this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue : '';
159 159
         $this->dhRegEvento = $this->rinfEvento->getElementsByTagName("dhRegEvento")->item(0)->nodeValue;
160 160
         $this->nProt = $this->rinfEvento->getElementsByTagName("nProt")->item(0)->nodeValue;
161 161
     }
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
         $this->orientacao = $orientacao;
220 220
         $this->papel = $papel;
221 221
         $this->logoAlign = $logoAlign;
222
-        if ($classPDF!==false) {
223
-            $this->pdf = $classPDF ;
222
+        if ($classPDF !== false) {
223
+            $this->pdf = $classPDF;
224 224
         } else {
225 225
             $this->pdf = new Pdf($this->orientacao, 'mm', $this->papel);
226 226
         }
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
             // posição inicial do relatorio
233 233
             $xInic = 1;
234 234
             $yInic = 1;
235
-            if ($this->papel =='A4') { //A4 210x297mm
235
+            if ($this->papel == 'A4') { //A4 210x297mm
236 236
                 $maxW = 210;
237 237
                 $maxH = 297;
238 238
             }
@@ -244,16 +244,16 @@  discard block
 block discarded – undo
244 244
             // posição inicial do relatorio
245 245
             $xInic = 5;
246 246
             $yInic = 5;
247
-            if ($papel =='A4') {
247
+            if ($papel == 'A4') {
248 248
                 //A4 210x297mm
249 249
                 $maxH = 210;
250 250
                 $maxW = 297;
251 251
             }
252 252
         }
253 253
         //largura imprimivel em mm
254
-        $this->wPrint = $maxW-($margEsq+$xInic);
254
+        $this->wPrint = $maxW - ($margEsq + $xInic);
255 255
         //comprimento imprimivel em mm
256
-        $this->hPrint = $maxH-($margSup+$yInic);
256
+        $this->hPrint = $maxH - ($margSup + $yInic);
257 257
         // estabelece contagem de paginas
258 258
         $this->pdf->aliasNbPages();
259 259
         // fixa as margens
@@ -273,11 +273,11 @@  discard block
 block discarded – undo
273 273
         //coloca o cabeçalho
274 274
         $y = $this->zCabecalho($x, $y, $pag, $situacao_externa);
275 275
         //coloca os dados da CCe
276
-        $y = $this->zCorpo($x, $y+15);
276
+        $y = $this->zCorpo($x, $y + 15);
277 277
         //coloca os dados da CCe
278
-        $y = $this->zRodape($x, $y+$this->hPrint-20);
278
+        $y = $this->zRodape($x, $y + $this->hPrint - 20);
279 279
         //retorna o ID do evento
280
-        if ($classPDF !==false) {
280
+        if ($classPDF !== false) {
281 281
             $aR = array(
282 282
                 'id'=>$this->id,
283 283
                 'classe_PDF'=>$this->pdf);
@@ -304,14 +304,14 @@  discard block
 block discarded – undo
304 304
         $maxW = $this->wPrint;
305 305
         //####################################################################################
306 306
         //coluna esquerda identificação do emitente
307
-        $w = round($maxW*0.41, 0);// 80;
307
+        $w = round($maxW * 0.41, 0); // 80;
308 308
         if ($this->orientacao == 'P') {
309 309
             $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
310 310
         } else {
311 311
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
312 312
         }
313 313
         $w1 = $w;
314
-        $h=32;
314
+        $h = 32;
315 315
         $oldY += $h;
316 316
         $this->pTextBox($x, $y, $w, $h);
317 317
         $texto = 'IDENTIFICAÇÃO DO EMITENTE';
@@ -319,130 +319,130 @@  discard block
 block discarded – undo
319 319
         if (is_file($this->logomarca)) {
320 320
             $logoInfo = getimagesize($this->logomarca);
321 321
             //largura da imagem em mm
322
-            $logoWmm = ($logoInfo[0]/72)*25.4;
322
+            $logoWmm = ($logoInfo[0] / 72) * 25.4;
323 323
             //altura da imagem em mm
324
-            $logoHmm = ($logoInfo[1]/72)*25.4;
325
-            if ($this->logoAlign=='L') {
326
-                $nImgW = round($w/3, 0);
327
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
328
-                $xImg = $x+1;
329
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
324
+            $logoHmm = ($logoInfo[1] / 72) * 25.4;
325
+            if ($this->logoAlign == 'L') {
326
+                $nImgW = round($w / 3, 0);
327
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
328
+                $xImg = $x + 1;
329
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
330 330
                 //estabelecer posições do texto
331
-                $x1 = round($xImg + $nImgW +1, 0);
332
-                $y1 = round($h/3+$y, 0);
333
-                $tw = round(2*$w/3, 0);
331
+                $x1 = round($xImg + $nImgW + 1, 0);
332
+                $y1 = round($h / 3 + $y, 0);
333
+                $tw = round(2 * $w / 3, 0);
334 334
             }
335
-            if ($this->logoAlign=='C') {
336
-                $nImgH = round($h/3, 0);
337
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
338
-                $xImg = round(($w-$nImgW)/2+$x, 0);
339
-                $yImg = $y+3;
335
+            if ($this->logoAlign == 'C') {
336
+                $nImgH = round($h / 3, 0);
337
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
338
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
339
+                $yImg = $y + 3;
340 340
                 $x1 = $x;
341 341
                 $y1 = round($yImg + $nImgH + 1, 0);
342 342
                 $tw = $w;
343 343
             }
344
-            if ($this->logoAlign=='R') {
345
-                $nImgW = round($w/3, 0);
346
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
347
-                $xImg = round($x+($w-(1+$nImgW)), 0);
348
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
344
+            if ($this->logoAlign == 'R') {
345
+                $nImgW = round($w / 3, 0);
346
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
347
+                $xImg = round($x + ($w - (1 + $nImgW)), 0);
348
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
349 349
                 $x1 = $x;
350
-                $y1 = round($h/3+$y, 0);
351
-                $tw = round(2*$w/3, 0);
350
+                $y1 = round($h / 3 + $y, 0);
351
+                $tw = round(2 * $w / 3, 0);
352 352
             }
353 353
             $this->pdf->Image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, 'jpeg');
354 354
         } else {
355 355
             $x1 = $x;
356
-            $y1 = round($h/3+$y, 0);
356
+            $y1 = round($h / 3 + $y, 0);
357 357
             $tw = $w;
358 358
         }
359 359
         //Nome emitente
360 360
         $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B');
361
-        $texto = (isset($this->aEnd['razao'])?$this->aEnd['razao']:'');
361
+        $texto = (isset($this->aEnd['razao']) ? $this->aEnd['razao'] : '');
362 362
         $this->pTextBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
363 363
         //endereço
364
-        $y1 = $y1+6;
364
+        $y1 = $y1 + 6;
365 365
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
366
-        $lgr = (isset($this->aEnd['logradouro'])?$this->aEnd['logradouro']:'');
367
-        $nro = (isset($this->aEnd['numero'])?$this->aEnd['numero']:'');
368
-        $cpl = (isset($this->aEnd['complemento'])?$this->aEnd['complemento']:'');
369
-        $bairro = (isset($this->aEnd['bairro'])?$this->aEnd['bairro']:'');
370
-        $CEP = (isset($this->aEnd['CEP'])?$this->aEnd['CEP']:'');
366
+        $lgr = (isset($this->aEnd['logradouro']) ? $this->aEnd['logradouro'] : '');
367
+        $nro = (isset($this->aEnd['numero']) ? $this->aEnd['numero'] : '');
368
+        $cpl = (isset($this->aEnd['complemento']) ? $this->aEnd['complemento'] : '');
369
+        $bairro = (isset($this->aEnd['bairro']) ? $this->aEnd['bairro'] : '');
370
+        $CEP = (isset($this->aEnd['CEP']) ? $this->aEnd['CEP'] : '');
371 371
         $CEP = $this->pFormat($CEP, "#####-###");
372
-        $mun = (isset($this->aEnd['municipio'])?$this->aEnd['municipio']:'');
373
-        $UF = (isset($this->aEnd['UF'])?$this->aEnd['UF']:'');
374
-        $fone = (isset($this->aEnd['telefone'])?$this->aEnd['telefone']:'');
375
-        $email = (isset($this->aEnd['email'])?$this->aEnd['email']:'');
372
+        $mun = (isset($this->aEnd['municipio']) ? $this->aEnd['municipio'] : '');
373
+        $UF = (isset($this->aEnd['UF']) ? $this->aEnd['UF'] : '');
374
+        $fone = (isset($this->aEnd['telefone']) ? $this->aEnd['telefone'] : '');
375
+        $email = (isset($this->aEnd['email']) ? $this->aEnd['email'] : '');
376 376
         $foneLen = strlen($fone);
377 377
         if ($foneLen > 0) {
378
-            $fone2 = substr($fone, 0, $foneLen-4);
379
-            $fone1 = substr($fone, 0, $foneLen-8);
378
+            $fone2 = substr($fone, 0, $foneLen - 4);
379
+            $fone1 = substr($fone, 0, $foneLen - 8);
380 380
             $fone = '(' . $fone1 . ') ' . substr($fone2, -4) . '-' . substr($fone, -4);
381 381
         } else {
382 382
             $fone = '';
383 383
         }
384 384
         if ($email != '') {
385
-            $email = 'Email: '.$email;
385
+            $email = 'Email: ' . $email;
386 386
         }
387 387
         $texto = "";
388
-        $tmp_txt = trim(($lgr!=''?"$lgr, ":'').($nro!=0?$nro:"SN").($cpl!=''?" - $cpl":''));
389
-        $tmp_txt = ($tmp_txt=='SN'?'':$tmp_txt);
390
-        $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt;
391
-        $tmp_txt = trim($bairro.($bairro!='' && $CEP!=''?" - ":'').$CEP);
392
-        $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt;
388
+        $tmp_txt = trim(($lgr != '' ? "$lgr, " : '') . ($nro != 0 ? $nro : "SN") . ($cpl != '' ? " - $cpl" : ''));
389
+        $tmp_txt = ($tmp_txt == 'SN' ? '' : $tmp_txt);
390
+        $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt;
391
+        $tmp_txt = trim($bairro . ($bairro != '' && $CEP != '' ? " - " : '') . $CEP);
392
+        $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt;
393 393
         $tmp_txt = $mun;
394
-        $tmp_txt.= ($tmp_txt!='' && $UF!=''?" - ":'').$UF;
395
-        $tmp_txt.= ($tmp_txt!='' && $fone!=''?" - ":'').$fone;
396
-        $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt;
394
+        $tmp_txt .= ($tmp_txt != '' && $UF != '' ? " - " : '') . $UF;
395
+        $tmp_txt .= ($tmp_txt != '' && $fone != '' ? " - " : '') . $fone;
396
+        $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt;
397 397
         $tmp_txt = $email;
398
-        $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt;
399
-        $this->pTextBox($x1, $y1-2, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
398
+        $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt;
399
+        $this->pTextBox($x1, $y1 - 2, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
400 400
         //##################################################
401 401
         $w2 = round($maxW - $w, 0);
402 402
         $x += $w;
403 403
         $this->pTextBox($x, $y, $w2, $h);
404 404
         $y1 = $y + $h;
405 405
         $aFont = array('font'=>$this->fontePadrao, 'size'=>16, 'style'=>'B');
406
-        if ($this->tpEvento=='110110') {
407
-            $texto='Representação Gráfica de CCe';
406
+        if ($this->tpEvento == '110110') {
407
+            $texto = 'Representação Gráfica de CCe';
408 408
         } else {
409
-            $texto='Representação Gráfica de Evento';
409
+            $texto = 'Representação Gráfica de Evento';
410 410
         }
411
-        $this->pTextBox($x, $y+2, $w2, 8, $texto, $aFont, 'T', 'C', 0, '');
411
+        $this->pTextBox($x, $y + 2, $w2, 8, $texto, $aFont, 'T', 'C', 0, '');
412 412
         $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'I');
413
-        if ($this->tpEvento=='110110') {
414
-            $texto='(Carta de Correção Eletrônica)';
415
-        } elseif ($this->tpEvento=='110111') {
416
-            $texto='(Cancelamento de CTe)';
413
+        if ($this->tpEvento == '110110') {
414
+            $texto = '(Carta de Correção Eletrônica)';
415
+        } elseif ($this->tpEvento == '110111') {
416
+            $texto = '(Cancelamento de CTe)';
417 417
         }
418
-        $this->pTextBox($x, $y+7, $w2, 8, $texto, $aFont, 'T', 'C', 0, '');
419
-        $texto = 'ID do Evento: '.$this->id;
418
+        $this->pTextBox($x, $y + 7, $w2, 8, $texto, $aFont, 'T', 'C', 0, '');
419
+        $texto = 'ID do Evento: ' . $this->id;
420 420
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'');
421
-        $this->pTextBox($x, $y+15, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
421
+        $this->pTextBox($x, $y + 15, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
422 422
         $tsHora = $this->pConvertTime($this->dhEvento);
423
-        $texto = 'Criado em : '. date('d/m/Y   H:i:s', $tsHora);
424
-        $this->pTextBox($x, $y+20, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
423
+        $texto = 'Criado em : ' . date('d/m/Y   H:i:s', $tsHora);
424
+        $this->pTextBox($x, $y + 20, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
425 425
         $tsHora = $this->pConvertTime($this->dhRegEvento);
426
-        $texto = 'Prococolo: '.$this->nProt.'  -  Registrado na SEFAZ em: '.date('d/m/Y   H:i:s', $tsHora);
427
-        $this->pTextBox($x, $y+25, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
426
+        $texto = 'Prococolo: ' . $this->nProt . '  -  Registrado na SEFAZ em: ' . date('d/m/Y   H:i:s', $tsHora);
427
+        $this->pTextBox($x, $y + 25, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
428 428
         //####################################################
429 429
         $x = $oldX;
430 430
         $this->pTextBox($x, $y1, $maxW, 40);
431
-        $sY = $y1+40;
432
-        if ($this->tpEvento=='110110') {
431
+        $sY = $y1 + 40;
432
+        if ($this->tpEvento == '110110') {
433 433
             $texto = 'De acordo com as determinações legais vigentes, vimos por meio '
434 434
                     . 'desta comunicar-lhe que o Conhecimento de Transporte, abaixo referenciado, '
435 435
                     . 'contêm irregularidades que estão destacadas e suas respectivas '
436 436
                     . 'correções, solicitamos que sejam aplicadas essas correções ao '
437 437
                     . 'executar seus lançamentos fiscais.';
438
-        } elseif ($this->tpEvento=='110111') {
438
+        } elseif ($this->tpEvento == '110111') {
439 439
             $texto = 'De acordo com as determinações legais vigentes, vimos por meio '
440 440
                     . 'desta comunicar-lhe que o  Conhecimento de Transporte, abaixo referenciado, está '
441 441
                     . 'cancelado, solicitamos que sejam aplicadas essas correções ao '
442 442
                     . 'executar seus lançamentos fiscais.';
443 443
         }
444 444
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'');
445
-        $this->pTextBox($x+5, $y1, $maxW-5, 20, $texto, $aFont, 'T', 'L', 0, '', false);
445
+        $this->pTextBox($x + 5, $y1, $maxW - 5, 20, $texto, $aFont, 'T', 'L', 0, '', false);
446 446
         //############################################
447 447
         $x = $oldX;
448 448
         $y = $y1;
@@ -450,45 +450,45 @@  discard block
 block discarded – undo
450 450
         $numNF = substr($this->chCTe, 25, 9);
451 451
         $serie = substr($this->chCTe, 22, 3);
452 452
         $numNF = $this->pFormat($numNF, "###.###.###");
453
-        $texto = "Conhecimento: " . $numNF .'  -   Série: '.$serie;
454
-        $this->pTextBox($x+2, $y+19, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
453
+        $texto = "Conhecimento: " . $numNF . '  -   Série: ' . $serie;
454
+        $this->pTextBox($x + 2, $y + 19, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
455 455
         $bW = 87;
456 456
         $bH = 15;
457 457
         $x = 55;
458
-        $y = $y1+13;
458
+        $y = $y1 + 13;
459 459
         $w = $maxW;
460 460
         $this->pdf->setFillColor(0, 0, 0);
461
-        $this->pdf->code128($x+(($w-$bW)/2), $y+2, $this->chCTe, $bW, $bH);
461
+        $this->pdf->code128($x + (($w - $bW) / 2), $y + 2, $this->chCTe, $bW, $bH);
462 462
         $this->pdf->setFillColor(255, 255, 255);
463
-        $y1 = $y+2+$bH;
463
+        $y1 = $y + 2 + $bH;
464 464
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'');
465 465
         $texto = $this->pFormat($this->chCTe, $this->formatoChave);
466
-        $this->pTextBox($x, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
467
-        $retVal = $sY+2;
468
-        if ($this->tpEvento=='110110') {
466
+        $this->pTextBox($x, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
467
+        $retVal = $sY + 2;
468
+        if ($this->tpEvento == '110110') {
469 469
             $x = $oldX;
470 470
             $this->pTextBox($x, $sY, $maxW, 15);
471 471
             $texto = $this->xCondUso;
472 472
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'I');
473
-            $this->pTextBox($x+2, $sY+2, $maxW-2, 15, $texto, $aFont, 'T', 'L', 0, '', false);
474
-            $retVal = $sY+2;
473
+            $this->pTextBox($x + 2, $sY + 2, $maxW - 2, 15, $texto, $aFont, 'T', 'L', 0, '', false);
474
+            $retVal = $sY + 2;
475 475
         }
476 476
         if ($this->tpAmb != 1) {
477 477
             $x = 10;
478 478
             if ($this->orientacao == 'P') {
479
-                $y = round($this->hPrint*2/3, 0);
479
+                $y = round($this->hPrint * 2 / 3, 0);
480 480
             } else {
481
-                $y = round($this->hPrint/2, 0);
481
+                $y = round($this->hPrint / 2, 0);
482 482
             }
483 483
             $h = 5;
484
-            $w = $maxW-(2*$x);
484
+            $w = $maxW - (2 * $x);
485 485
             $this->pdf->setTextColor(90, 90, 90);
486 486
             $texto = "SEM VALOR FISCAL";
487 487
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
488 488
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
489 489
             $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
490 490
             $texto = "AMBIENTE DE HOMOLOGAÇÃO";
491
-            $this->pTextBox($x, $y+14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
491
+            $this->pTextBox($x, $y + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
492 492
             $this->pdf->setTextColor(0, 0, 0);
493 493
         }
494 494
         return $retVal;
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
     private function zCorpo($x, $y)
503 503
     {
504 504
         $maxW = $this->wPrint;
505
-        if ($this->tpEvento=='110110') {
505
+        if ($this->tpEvento == '110110') {
506 506
             $texto = 'CORREÇÕES A SEREM CONSIDERADAS';
507 507
         } else {
508 508
             $texto = 'JUSTIFICATIVA DO CANCELAMENTO';
@@ -511,13 +511,13 @@  discard block
 block discarded – undo
511 511
         $this->pTextBox($x, $y, $maxW, 5, $texto, $aFont, 'T', 'L', 0, '', false);
512 512
         $y += 5;
513 513
         $this->pTextBox($x, $y, $maxW, 190);
514
-        if ($this->tpEvento=='110110') {
514
+        if ($this->tpEvento == '110110') {
515 515
             $texto = $this->xCorrecao;
516
-        } elseif ($this->tpEvento=='110111') {
516
+        } elseif ($this->tpEvento == '110111') {
517 517
             $texto = $this->xJust;
518 518
         }
519 519
         $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B');
520
-        $this->pTextBox($x+2, $y+2, $maxW-2, 150, $texto, $aFont, 'T', 'L', 0, '', false);
520
+        $this->pTextBox($x + 2, $y + 2, $maxW - 2, 150, $texto, $aFont, 'T', 'L', 0, '', false);
521 521
     }
522 522
     
523 523
     /**
@@ -528,12 +528,12 @@  discard block
 block discarded – undo
528 528
     private function zRodape($x, $y)
529 529
     {
530 530
         $w = $this->wPrint;
531
-        if ($this->tpEvento=='110110') {
531
+        if ($this->tpEvento == '110110') {
532 532
             $texto = "Este documento é uma representação gráfica da CCe e foi "
533 533
                     . "impresso apenas para sua informação e não possue validade fiscal."
534 534
                     . "\n A CCe deve ser recebida e mantida em arquivo eletrônico XML e "
535 535
                     . "pode ser consultada através dos Portais das SEFAZ.";
536
-        } elseif ($this->tpEvento=='110111') {
536
+        } elseif ($this->tpEvento == '110111') {
537 537
             $texto = "Este documento é uma representação gráfica do evento de CTe e foi "
538 538
                     . "impresso apenas para sua informação e não possue validade fiscal."
539 539
                     . "\n O Evento deve ser recebido e mantido em arquivo eletrônico XML e "
@@ -541,9 +541,9 @@  discard block
 block discarded – undo
541 541
         }
542 542
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'I');
543 543
         $this->pTextBox($x, $y, $w, 20, $texto, $aFont, 'T', 'C', 0, '', false);
544
-        $y = $this->hPrint -4;
545
-        $texto = "Impresso em  ". date('d/m/Y   H:i:s');
546
-        $w = $this->wPrint-4;
544
+        $y = $this->hPrint - 4;
545
+        $texto = "Impresso em  " . date('d/m/Y   H:i:s');
546
+        $w = $this->wPrint - 4;
547 547
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
548 548
         $this->pTextBox($x, $y, $w, 4, $texto, $aFont, 'T', 'L', 0, '');
549 549
         $texto = "Daevento ver. " . $this->version
Please login to merge, or discard this patch.