Passed
Push — master ( 87b6ec...820633 )
by Tobias
02:26
created
src/WrkLst/DocxMustache/DocxMustache.php 3 patches
Doc Comments   +14 added lines, -3 removed lines patch added patch discarded remove patch
@@ -95,7 +95,6 @@  discard block
 block discarded – undo
95 95
     }
96 96
 
97 97
     /**
98
-     * @param string $value
99 98
      */
100 99
     protected function exctractOpenXmlFile($file)
101 100
     {
@@ -104,7 +103,6 @@  discard block
 block discarded – undo
104 103
     }
105 104
 
106 105
     /**
107
-     * @param string $value
108 106
      */
109 107
     protected function readOpenXmlFile($file)
110 108
     {
@@ -120,7 +118,7 @@  discard block
 block discarded – undo
120 118
     }
121 119
 
122 120
     /**
123
-     * @param string $value
121
+     * @param string $file
124 122
      */
125 123
     protected function readOpenXmlObject($file)
126 124
     {
@@ -129,6 +127,10 @@  discard block
 block discarded – undo
129 127
         return simplexml_load_file($this->storagePath($this->local_path.$file));
130 128
     }
131 129
 
130
+    /**
131
+     * @param string $file
132
+     * @param string|false $folder
133
+     */
132 134
     protected function saveOpenXmlFile($file,$folder,$content)
133 135
     {
134 136
         \Storage::disk($this->storageDisk)
@@ -216,6 +218,9 @@  discard block
 block discarded – undo
216 218
         }
217 219
     }
218 220
 
221
+    /**
222
+     * @param \SimpleXMLElement $main_file
223
+     */
219 224
     protected function FetchReplaceableImages(&$main_file, $ns)
220 225
     {
221 226
         //set up basic arrays to keep track of imgs
@@ -268,6 +273,9 @@  discard block
 block discarded – undo
268 273
         );
269 274
     }
270 275
 
276
+    /**
277
+     * @param \SimpleXMLElement $rels_file
278
+     */
271 279
     protected function RemoveReplaceImages($imgs_replaced, &$rels_file)
272 280
     {
273 281
         //iterate through replaced images and clean rels files from them
@@ -319,6 +327,9 @@  discard block
 block discarded – undo
319 327
         return false;
320 328
     }
321 329
 
330
+    /**
331
+     * @param string $data
332
+     */
322 333
     protected function ResampleImage($imgs, $k, $data)
323 334
     {
324 335
         \Storage::disk($this->storageDisk)->put($this->local_path.'word/media/'.$imgs[$k]['img_file_src'], $data);
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         return simplexml_load_file($this->storagePath($this->local_path.$file));
130 130
     }
131 131
 
132
-    protected function saveOpenXmlFile($file,$folder,$content)
132
+    protected function saveOpenXmlFile($file, $folder, $content)
133 133
     {
134 134
         \Storage::disk($this->storageDisk)
135 135
             ->put($this->local_path.$file, $content);
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 
153 153
         $this->log('Compact Template with Data');
154 154
 
155
-        $this->saveOpenXmlFile('word/document.xml','word',$this->word_doc);
155
+        $this->saveOpenXmlFile('word/document.xml', 'word', $this->word_doc);
156 156
         $this->zipper->close();
157 157
     }
158 158
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
     protected function MustacheRender($items, $mustache_template, $clean_tags = true)
173 173
     {
174
-        if($clean_tags)
174
+        if ($clean_tags)
175 175
             $mustache_template = $this->MustacheTagCleaner($mustache_template);
176 176
 
177 177
         $m = new \Mustache_Engine(array('escape' => function($value) {
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 
209 209
             if ($ct_file_xml = $ct_file->asXML())
210 210
             {
211
-                $this->saveOpenXmlFile('[Content_Types].xml',false,$ct_file_xml);
211
+                $this->saveOpenXmlFile('[Content_Types].xml', false, $ct_file_xml);
212 212
             } else
213 213
             {
214 214
                 throw new Exception('Cannot generate xml for [Content_Types].xml.');
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
         foreach ($imgs as $k=>$img)
358 358
         {
359 359
             //get file type of img and test it against supported imgs
360
-            if($imgageData = $this->GetImageFromUrl($img['url']))
360
+            if ($imgageData = $this->GetImageFromUrl($img['url']))
361 361
             {
362 362
                 $imgs[$k]['img_file_src'] = str_replace("wrklstId", "wrklst_image", $img['id']).$allowed_imgs[$imgageData['mime']];
363 363
                 $imgs[$k]['img_file_dest'] = str_replace("wrklstId", "wrklst_image", $img['id']).'.jpeg';
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 
425 425
         if ($rels_file_xml = $rels_file->asXML())
426 426
         {
427
-            $this->saveOpenXmlFile('word/_rels/document.xml.rels','word/_rels',$rels_file_xml);
427
+            $this->saveOpenXmlFile('word/_rels/document.xml.rels', 'word/_rels', $rels_file_xml);
428 428
         } else
429 429
         {
430 430
             throw new Exception('Cannot generate xml for word/_rels/document.xml.rels.');
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -60,8 +60,9 @@  discard block
 block discarded – undo
60 60
     {
61 61
         //introduce logging method here to keep track of process
62 62
         // can be overwritten in extended class to log with custom preocess logger
63
-        if ($this->verbose)
64
-            Log::error($msg);
63
+        if ($this->verbose) {
64
+                    Log::error($msg);
65
+        }
65 66
     }
66 67
 
67 68
     public function cleanUpTmpDirs()
@@ -171,8 +172,9 @@  discard block
 block discarded – undo
171 172
 
172 173
     protected function MustacheRender($items, $mustache_template, $clean_tags = true)
173 174
     {
174
-        if($clean_tags)
175
-            $mustache_template = $this->MustacheTagCleaner($mustache_template);
175
+        if($clean_tags) {
176
+                    $mustache_template = $this->MustacheTagCleaner($mustache_template);
177
+        }
176 178
 
177 179
         $m = new \Mustache_Engine(array('escape' => function($value) {
178 180
             if (str_replace('*[[DONOTESCAPE]]*', '', $value) != $value) {
Please login to merge, or discard this patch.