Passed
Push — 1.10.x ( aa45ad...6deddd )
by Yannick
44:37
created
main/inc/lib/phpdocx/pdf/include/canvas_factory.cls.php 1 patch
Braces   +14 added lines, -18 removed lines patch added patch discarded remove patch
@@ -58,24 +58,20 @@
 block discarded – undo
58 58
 
59 59
     $backend = strtolower(DOMPDF_PDF_BACKEND);
60 60
     
61
-    if ( isset($class) && class_exists($class, false) )
62
-      $class .= "_Adapter";
63
-    
64
-    else if ( (DOMPDF_PDF_BACKEND === "auto" || $backend === "pdflib" ) &&
65
-              class_exists("PDFLib", false) )
66
-      $class = "PDFLib_Adapter";
67
-
68
-    else if ( (DOMPDF_PDF_BACKEND === "auto" || $backend === "cpdf") )
69
-      $class = "CPDF_Adapter";
70
-
71
-    else if ( ( $backend === "tcpdf") )
72
-      $class = "TCPDF_Adapter";
73
-      
74
-    else if ( $backend === "gd" )
75
-      $class = "GD_Adapter";
76
-    
77
-    else
78
-      $class = "CPDF_Adapter";
61
+    if ( isset($class) && class_exists($class, false) ) {
62
+          $class .= "_Adapter";
63
+    } else if ( (DOMPDF_PDF_BACKEND === "auto" || $backend === "pdflib" ) &&
64
+              class_exists("PDFLib", false) ) {
65
+          $class = "PDFLib_Adapter";
66
+    } else if ( (DOMPDF_PDF_BACKEND === "auto" || $backend === "cpdf") ) {
67
+          $class = "CPDF_Adapter";
68
+    } else if ( ( $backend === "tcpdf") ) {
69
+          $class = "TCPDF_Adapter";
70
+    } else if ( $backend === "gd" ) {
71
+          $class = "GD_Adapter";
72
+    } else {
73
+          $class = "CPDF_Adapter";
74
+    }
79 75
 
80 76
     return new $class($paper, $orientation);
81 77
         
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/font_metrics.cls.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -216,13 +216,15 @@
 block discarded – undo
216 216
    * @see save_font_families()
217 217
    */
218 218
   static function load_font_families() {
219
-    if ( !is_readable(self::CACHE_FILE) )
220
-      return;
219
+    if ( !is_readable(self::CACHE_FILE) ) {
220
+          return;
221
+    }
221 222
 
222 223
     $data = file_get_contents(self::CACHE_FILE);
223 224
 
224
-    if ( $data != "" )
225
-      eval ('self::$_font_lookup = ' . $data . ";");
225
+    if ( $data != "" ) {
226
+          eval ('self::$_font_lookup = ' . $data . ";");
227
+    }
226 228
   }
227 229
 
228 230
   /**
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/block_renderer.cls.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -58,8 +58,9 @@  discard block
 block discarded – undo
58 58
       $this->_canvas->filled_rectangle( $x, $y, $w, $h, $style->background_color );
59 59
     }
60 60
 
61
-    if ( ($url = $style->background_image) && $url !== "none" )
62
-      $this->_background_image($url, $x, $y, $w, $h, $style);
61
+    if ( ($url = $style->background_image) && $url !== "none" ) {
62
+          $this->_background_image($url, $x, $y, $w, $h, $style);
63
+    }
63 64
 
64 65
 
65 66
     $this->_render_border($frame);
@@ -81,8 +82,9 @@  discard block
 block discarded – undo
81 82
     foreach ($bp as $side => $props) {
82 83
       list($x, $y, $w, $h) = $bbox;
83 84
 
84
-      if ( !$props["style"] || $props["style"] === "none" || $props["width"] <= 0 )
85
-        continue;
85
+      if ( !$props["style"] || $props["style"] === "none" || $props["width"] <= 0 ) {
86
+              continue;
87
+      }
86 88
 
87 89
 
88 90
       switch($side) {
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/inline_frame_decorator.cls.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,8 +62,9 @@
 block discarded – undo
62 62
       return;
63 63
     }
64 64
     
65
-    if ( $frame->get_parent() !== $this )
66
-      throw new DOMPDF_Exception("Unable to split: frame is not a child of this one.");
65
+    if ( $frame->get_parent() !== $this ) {
66
+          throw new DOMPDF_Exception("Unable to split: frame is not a child of this one.");
67
+    }
67 68
         
68 69
     $split = $this->copy( $this->_frame->get_node()->cloneNode() ); 
69 70
     $this->get_parent()->insert_child_after($split, $this);
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/renderer.cls.php 1 patch
Braces   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -100,10 +100,11 @@  discard block
 block discarded – undo
100 100
       break;
101 101
 
102 102
     case "inline":
103
-      if ( $frame->get_node()->nodeName === "#text" )
104
-        $this->_render_frame("text", $frame);
105
-      else
106
-        $this->_render_frame("inline", $frame);
103
+      if ( $frame->get_node()->nodeName === "#text" ) {
104
+              $this->_render_frame("text", $frame);
105
+      } else {
106
+              $this->_render_frame("inline", $frame);
107
+      }
107 108
       break;
108 109
 
109 110
     case "table-cell":
@@ -126,9 +127,7 @@  discard block
 block discarded – undo
126 127
              $node->getAttribute("language") === "php" ) {
127 128
           // Evaluate embedded php scripts
128 129
           $this->_render_frame("php", $frame);
129
-        }
130
-        
131
-        elseif ( $node->getAttribute("type") === "text/javascript" ||
130
+        } elseif ( $node->getAttribute("type") === "text/javascript" ||
132 131
              $node->getAttribute("language") === "javascript" ) {
133 132
           // Insert JavaScript
134 133
           $this->_render_frame("javascript", $frame);
@@ -146,8 +145,9 @@  discard block
 block discarded – undo
146 145
     // Check for begin frame callback
147 146
     $this->_check_callbacks("begin_frame", $frame);
148 147
     
149
-    foreach ($frame->get_children() as $child)
150
-      $this->render($child);
148
+    foreach ($frame->get_children() as $child) {
149
+          $this->render($child);
150
+    }
151 151
 
152 152
     // Check for end frame callback
153 153
     $this->_check_callbacks("end_frame", $frame);
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/inline_renderer.cls.php 1 patch
Braces   +27 added lines, -18 removed lines patch added patch discarded remove patch
@@ -52,8 +52,10 @@  discard block
 block discarded – undo
52 52
   function render(Frame $frame) {
53 53
     $style = $frame->get_style();
54 54
 
55
-    if ( !$frame->get_first_child() )
56
-      return; // No children, no service
55
+    if ( !$frame->get_first_child() ) {
56
+          return;
57
+    }
58
+    // No children, no service
57 59
     
58 60
     // Draw the left border if applicable
59 61
     $bp = $style->get_border_properties();
@@ -87,8 +89,9 @@  discard block
 block discarded – undo
87 89
         // borders on this line.
88 90
 
89 91
         // Background:
90
-        if ( ($bg = $style->background_color) !== "transparent" )
91
-          $this->_canvas->filled_rectangle( $x, $y, $w, $h, $style->background_color);
92
+        if ( ($bg = $style->background_color) !== "transparent" ) {
93
+                  $this->_canvas->filled_rectangle( $x, $y, $w, $h, $style->background_color);
94
+        }
92 95
 
93 96
         if ( ($url = $style->background_image) && $url !== "none" ) {
94 97
           $this->_background_image($url, $x, $y, $w, $h, $style);
@@ -118,8 +121,9 @@  discard block
 block discarded – undo
118 121
         // Handle anchors & links
119 122
         if ( $frame->get_node()->nodeName === "a" ) {
120 123
                     
121
-          if ( $href = $frame->get_node()->getAttribute("href") )
122
-            $this->_canvas->add_link($href, $x, $y, $w, $h);
124
+          if ( $href = $frame->get_node()->getAttribute("href") ) {
125
+                      $this->_canvas->add_link($href, $x, $y, $w, $h);
126
+          }
123 127
 
124 128
         }
125 129
 
@@ -130,18 +134,20 @@  discard block
 block discarded – undo
130 134
         continue;
131 135
       }
132 136
 
133
-      if ( is_null($w) )
134
-        $w = $child_w;
135
-      else
136
-        $w += $child_w;
137
+      if ( is_null($w) ) {
138
+              $w = $child_w;
139
+      } else {
140
+              $w += $child_w;
141
+      }
137 142
       
138 143
       $h = max($h, $child_h);
139 144
     }
140 145
 
141 146
     
142 147
     // Handle the last child
143
-    if ( ($bg = $style->background_color) !== "transparent" ) 
144
-      $this->_canvas->filled_rectangle( $x + $widths[3], $y + $widths[0], $w, $h, $style->background_color);
148
+    if ( ($bg = $style->background_color) !== "transparent" ) {
149
+          $this->_canvas->filled_rectangle( $x + $widths[3], $y + $widths[0], $w, $h, $style->background_color);
150
+    }
145 151
 
146 152
     //On continuation lines (after line break) of inline elements, the style got copied.
147 153
     //But a non repeatable background image should not be repeated on the next line.
@@ -151,8 +157,9 @@  discard block
 block discarded – undo
151 157
     // Repeat not given: default is Style::__construct
152 158
     // ... && (!($repeat = $style->background_repeat) || $repeat === "repeat" ...
153 159
     //different position? $this->_background_image($url, $x, $y, $w, $h, $style);
154
-    if ( ($url = $style->background_image) && $url !== "none" )           
155
-      $this->_background_image($url, $x + $widths[3], $y + $widths[0], $w, $h, $style);
160
+    if ( ($url = $style->background_image) && $url !== "none" ) {
161
+          $this->_background_image($url, $x + $widths[3], $y + $widths[0], $w, $h, $style);
162
+    }
156 163
         
157 164
     // Add the border widths
158 165
     $w += $widths[1] + $widths[3];
@@ -190,11 +197,13 @@  discard block
 block discarded – undo
190 197
     // Handle anchors & links
191 198
     if ( $frame->get_node()->nodeName === "a" ) {
192 199
 
193
-      if ( $name = $frame->get_node()->getAttribute("name") )
194
-        $this->_canvas->add_named_dest($name);
200
+      if ( $name = $frame->get_node()->getAttribute("name") ) {
201
+              $this->_canvas->add_named_dest($name);
202
+      }
195 203
 
196
-      if ( $href = $frame->get_node()->getAttribute("href") )
197
-        $this->_canvas->add_link($href, $x, $y, $w, $h);
204
+      if ( $href = $frame->get_node()->getAttribute("href") ) {
205
+              $this->_canvas->add_link($href, $x, $y, $w, $h);
206
+      }
198 207
     }
199 208
   }
200 209
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/list_bullet_image_frame_decorator.cls.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -146,8 +146,9 @@
 block discarded – undo
146 146
     // Small hack to prevent indenting of list text
147 147
     // Image Might not exist, then position like on list_bullet_frame_decorator fallback to none. 
148 148
     if ( $this->_frame->get_style()->list_style_position === "outside" ||
149
-         $this->_width == 0) 
150
-      return 0;
149
+         $this->_width == 0) {
150
+          return 0;
151
+    }
151 152
     //This aligns the "inside" image position with the text.
152 153
     //The text starts to the right of the image.
153 154
     //Between the image and the text there is an added margin of image width.
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/frame_factory.cls.php 1 patch
Braces   +17 added lines, -13 removed lines patch added patch discarded remove patch
@@ -61,8 +61,9 @@  discard block
 block discarded – undo
61 61
 
62 62
   // FIXME: this is admittedly a little smelly...
63 63
   static function decorate_frame(Frame $frame, $dompdf) {
64
-    if ( is_null($dompdf) )
65
-      throw new Exception("foo");
64
+    if ( is_null($dompdf) ) {
65
+          throw new Exception("foo");
66
+    }
66 67
     switch ($frame->get_style()->display) {
67 68
       
68 69
     case "block":
@@ -127,15 +128,17 @@  discard block
 block discarded – undo
127 128
       break;
128 129
 
129 130
     case "-dompdf-list-bullet":
130
-      if ( $frame->get_style()->list_style_position === "inside" )
131
-        $positioner = "Inline";
132
-      else        
133
-        $positioner = "List_Bullet";
134
-
135
-      if ( $frame->get_style()->list_style_image !== "none" )
136
-        $decorator = "List_Bullet_Image";
137
-      else
138
-        $decorator = "List_Bullet";
131
+      if ( $frame->get_style()->list_style_position === "inside" ) {
132
+              $positioner = "Inline";
133
+      } else {
134
+              $positioner = "List_Bullet";
135
+      }
136
+
137
+      if ( $frame->get_style()->list_style_image !== "none" ) {
138
+              $decorator = "List_Bullet_Image";
139
+      } else {
140
+              $decorator = "List_Bullet";
141
+      }
139 142
       
140 143
       $reflower = "List_Bullet";
141 144
       break;
@@ -163,8 +166,9 @@  discard block
 block discarded – undo
163 166
     }
164 167
 
165 168
     if ( $frame->get_style()->position === "absolute" ||
166
-         $frame->get_style()->position === "fixed" )
167
-      $positioner = "Absolute";
169
+         $frame->get_style()->position === "fixed" ) {
170
+          $positioner = "Absolute";
171
+    }
168 172
     
169 173
     $positioner .= "_Positioner";
170 174
     $decorator .= "_Frame_Decorator";
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/frame_decorator.cls.php 1 patch
Braces   +85 added lines, -60 removed lines patch added patch discarded remove patch
@@ -102,8 +102,9 @@  discard block
 block discarded – undo
102 102
   function dispose($recursive = false) {
103 103
     
104 104
     if ( $recursive ) {
105
-      while ( $child = $this->get_first_child() )
106
-        $child->dispose(true);
105
+      while ( $child = $this->get_first_child() ) {
106
+              $child->dispose(true);
107
+      }
107 108
     }
108 109
     
109 110
     unset($this->_root);
@@ -134,8 +135,9 @@  discard block
 block discarded – undo
134 135
     $deco = Frame_Factory::decorate_frame($frame, $this->_dompdf);
135 136
     $deco->set_root($this->_root);
136 137
 
137
-    foreach ($this->get_children() as $child)
138
-      $deco->append_child($child->deep_copy());
138
+    foreach ($this->get_children() as $child) {
139
+          $deco->append_child($child->deep_copy());
140
+    }
139 141
 
140 142
     return $deco;
141 143
   }
@@ -146,8 +148,9 @@  discard block
 block discarded – undo
146 148
     $this->_frame->reset();
147 149
 
148 150
     // Reset all children
149
-    foreach ($this->get_children() as $child)
150
-      $child->reset();
151
+    foreach ($this->get_children() as $child) {
152
+          $child->reset();
153
+    }
151 154
 
152 155
   }
153 156
   
@@ -183,42 +186,49 @@  discard block
 block discarded – undo
183 186
   function __toString() { return $this->_frame->__toString(); }
184 187
   
185 188
   function prepend_child(Frame $child, $update_node = true) {
186
-    while ( $child instanceof Frame_Decorator )
187
-      $child = $child->_frame;
189
+    while ( $child instanceof Frame_Decorator ) {
190
+          $child = $child->_frame;
191
+    }
188 192
     
189 193
     $this->_frame->prepend_child($child, $update_node);
190 194
   }
191 195
 
192 196
   function append_child(Frame $child, $update_node = true) {
193
-    while ( $child instanceof Frame_Decorator )
194
-      $child = $child->_frame;
197
+    while ( $child instanceof Frame_Decorator ) {
198
+          $child = $child->_frame;
199
+    }
195 200
 
196 201
     $this->_frame->append_child($child, $update_node);
197 202
   }
198 203
 
199 204
   function insert_child_before(Frame $new_child, Frame $ref, $update_node = true) {
200
-    while ( $new_child instanceof Frame_Decorator )
201
-      $new_child = $new_child->_frame;
205
+    while ( $new_child instanceof Frame_Decorator ) {
206
+          $new_child = $new_child->_frame;
207
+    }
202 208
 
203
-    if ( $ref instanceof Frame_Decorator )
204
-      $ref = $ref->_frame;
209
+    if ( $ref instanceof Frame_Decorator ) {
210
+          $ref = $ref->_frame;
211
+    }
205 212
 
206 213
     $this->_frame->insert_child_before($new_child, $ref, $update_node);
207 214
   }
208 215
 
209 216
   function insert_child_after(Frame $new_child, Frame $ref, $update_node = true) {
210
-    while ( $new_child instanceof Frame_Decorator )
211
-      $new_child = $new_child->_frame;
217
+    while ( $new_child instanceof Frame_Decorator ) {
218
+          $new_child = $new_child->_frame;
219
+    }
212 220
 
213
-    while ( $ref instanceof Frame_Decorator )
214
-      $ref = $ref->_frame;
221
+    while ( $ref instanceof Frame_Decorator ) {
222
+          $ref = $ref->_frame;
223
+    }
215 224
     
216 225
     $this->_frame->insert_child_after($new_child, $ref, $update_node);
217 226
   }
218 227
 
219 228
   function remove_child(Frame $child, $update_node = true) {
220
-    while  ( $child instanceof Frame_Decorator )
221
-      $child = $new_child->_frame;
229
+    while  ( $child instanceof Frame_Decorator ) {
230
+          $child = $new_child->_frame;
231
+    }
222 232
 
223 233
     $this->_frame->remove_child($child, $update_node);
224 234
   }
@@ -230,61 +240,71 @@  discard block
 block discarded – undo
230 240
     $p = $this->_frame->get_parent();
231 241
     
232 242
     if ( $p && $deco = $p->get_decorator() ) {
233
-      while ( $tmp = $deco->get_decorator() )
234
-        $deco = $tmp;      
243
+      while ( $tmp = $deco->get_decorator() ) {
244
+              $deco = $tmp;
245
+      }
235 246
       return $deco;
236
-    } else if ( $p )
237
-      return $p;
238
-    else
239
-      return null;
247
+    } else if ( $p ) {
248
+          return $p;
249
+    } else {
250
+          return null;
251
+    }
240 252
   }
241 253
 
242 254
   function get_first_child() {
243 255
     $c = $this->_frame->get_first_child();
244 256
     if ( $c && $deco = $c->get_decorator() ) {
245
-      while ( $tmp = $deco->get_decorator() )
246
-        $deco = $tmp;      
257
+      while ( $tmp = $deco->get_decorator() ) {
258
+              $deco = $tmp;
259
+      }
247 260
       return $deco;
248
-    } else if ( $c )
249
-      return $c;
250
-    else
251
-      return null;
261
+    } else if ( $c ) {
262
+          return $c;
263
+    } else {
264
+          return null;
265
+    }
252 266
   }
253 267
 
254 268
   function get_last_child() {
255 269
     $c = $this->_frame->get_last_child();
256 270
     if ( $c && $deco = $c->get_decorator() ) {
257
-      while ( $tmp = $deco->get_decorator() )
258
-        $deco = $tmp;      
271
+      while ( $tmp = $deco->get_decorator() ) {
272
+              $deco = $tmp;
273
+      }
259 274
       return $deco;
260
-    } else if ( $c )
261
-      return $c;
262
-    else
263
-      return null;
275
+    } else if ( $c ) {
276
+          return $c;
277
+    } else {
278
+          return null;
279
+    }
264 280
   }
265 281
 
266 282
   function get_prev_sibling() {
267 283
     $s = $this->_frame->get_prev_sibling();
268 284
     if ( $s && $deco = $s->get_decorator() ) {
269
-      while ( $tmp = $deco->get_decorator() )
270
-        $deco = $tmp;      
285
+      while ( $tmp = $deco->get_decorator() ) {
286
+              $deco = $tmp;
287
+      }
271 288
       return $deco;
272
-    } else if ( $s )
273
-      return $s;
274
-    else
275
-      return null;
289
+    } else if ( $s ) {
290
+          return $s;
291
+    } else {
292
+          return null;
293
+    }
276 294
   }
277 295
   
278 296
   function get_next_sibling() {
279 297
     $s = $this->_frame->get_next_sibling();
280 298
     if ( $s && $deco = $s->get_decorator() ) {
281
-      while ( $tmp = $deco->get_decorator() )
282
-        $deco = $tmp;      
299
+      while ( $tmp = $deco->get_decorator() ) {
300
+              $deco = $tmp;
301
+      }
283 302
       return $deco;
284
-    } else if ( $s )
285
-      return $s;
286
-    else
287
-      return null;
303
+    } else if ( $s ) {
304
+          return $s;
305
+    } else {
306
+          return null;
307
+    }
288 308
   }
289 309
 
290 310
   function get_children() {
@@ -299,16 +319,18 @@  discard block
 block discarded – undo
299 319
 
300 320
   function set_positioner(Positioner $posn) {
301 321
     $this->_positioner = $posn;
302
-    if ( $this->_frame instanceof Frame_Decorator )
303
-      $this->_frame->set_positioner($posn);
322
+    if ( $this->_frame instanceof Frame_Decorator ) {
323
+          $this->_frame->set_positioner($posn);
324
+    }
304 325
   }
305 326
   
306 327
   //........................................................................
307 328
 
308 329
   function set_reflower(Frame_Reflower $reflower) {
309 330
     $this->_reflower = $reflower;
310
-    if ( $this->_frame instanceof Frame_Decorator )
311
-      $this->_frame->set_reflower( $reflower );
331
+    if ( $this->_frame instanceof Frame_Decorator ) {
332
+          $this->_frame->set_reflower( $reflower );
333
+    }
312 334
   }
313 335
   
314 336
   function get_reflower() { return $this->_reflower; }
@@ -317,8 +339,9 @@  discard block
 block discarded – undo
317 339
   
318 340
   function set_root(Frame $root) {
319 341
     $this->_root = $root;
320
-      if ( $this->_frame instanceof Frame_Decorator )
321
-        $this->_frame->set_root($root);
342
+      if ( $this->_frame instanceof Frame_Decorator ) {
343
+              $this->_frame->set_root($root);
344
+      }
322 345
   }
323 346
   
324 347
   function get_root() { return $this->_root; }
@@ -331,8 +354,9 @@  discard block
 block discarded – undo
331 354
     $p = $this->get_parent();
332 355
     
333 356
     while ( $p ) {
334
-      if ( in_array($p->get_style()->display, Style::$BLOCK_TYPES) )
335
-        break;
357
+      if ( in_array($p->get_style()->display, Style::$BLOCK_TYPES) ) {
358
+              break;
359
+      }
336 360
 
337 361
       $p = $p->get_parent();
338 362
     }
@@ -358,8 +382,9 @@  discard block
 block discarded – undo
358 382
       return;
359 383
     }
360 384
     
361
-    if ( $child->get_parent() !== $this )
362
-      throw new DOMPDF_Exception("Unable to split: frame is not a child of this one.");
385
+    if ( $child->get_parent() !== $this ) {
386
+          throw new DOMPDF_Exception("Unable to split: frame is not a child of this one.");
387
+    }
363 388
 
364 389
     $split = $this->copy( $this->_frame->get_node()->cloneNode() );
365 390
     $split->reset();
Please login to merge, or discard this patch.