Code Duplication    Length = 5-5 lines in 6 locations

src/Intraface/modules/debtor/Visitor/Pdf.php 6 locations

@@ 144-148 (lines=5) @@
141
        for ($i = 0, $max = count($items); $i <  $max; $i++) {
142
            $vat = $items[$i]["vat"];
143
144
            if ($bg_color == 1) {
145
                $this->doc->setColor(0.8, 0.8, 0.8);
146
                $this->doc->filledRectangle($this->doc->get("margin_left"), $this->doc->get('y') - $this->doc->get("font_spacing"), $this->doc->get('right_margin_position') - $this->doc->get("margin_left"), $this->doc->get("font_spacing"));
147
                $this->doc->setColor(0, 0, 0);
148
            }
149
150
            $this->doc->setY('-'.($this->doc->get("font_padding_top") + $this->doc->get("font_size")));
151
            $this->doc->addText($apointX["varenr"] - $this->doc->getTextWidth($this->doc->get("font_size"), $items[$i]["number"]), $this->doc->get('y'), $this->doc->get("font_size"), $items[$i]["number"]);
@@ 178-182 (lines=5) @@
175
            while ($tekst != "") {
176
                if (!$first) {
177
                    // first line has already got coloured
178
                    if ($bg_color == 1) {
179
                        $this->doc->setColor(0.8, 0.8, 0.8);
180
                        $this->doc->filledRectangle($this->doc->get("margin_left"), $this->doc->get('y') - $this->doc->get("font_spacing"), $this->doc->get('right_margin_position') - $this->doc->get("margin_left"), $this->doc->get("font_spacing"));
181
                        $this->doc->setColor(0, 0, 0);
182
                    }
183
                    $this->doc->setY('-'.($this->doc->get("font_padding_top") + $this->doc->get("font_size")));
184
                }
185
                $first = false;
@@ 198-202 (lines=5) @@
195
            if ($items[$i]["description"] != "") {
196
                // space to the text
197
                $this->doc->setY('-'.($this->doc->get("font_spacing")/2));
198
                if ($bg_color == 1) {
199
                    $this->doc->setColor(0.8, 0.8, 0.8);
200
                    $this->doc->filledRectangle($this->doc->get("margin_left"), $this->doc->get('y'), $this->doc->get('right_margin_position') - $this->doc->get("margin_left"), $this->doc->get("font_spacing")/2);
201
                    $this->doc->setColor(0, 0, 0);
202
                }
203
204
                $desc_line = explode("\r\n", $items[$i]["description"]);
205
                foreach ($desc_line as $line) {
@@ 207-211 (lines=5) @@
204
                $desc_line = explode("\r\n", $items[$i]["description"]);
205
                foreach ($desc_line as $line) {
206
                    if ($line == "") {
207
                        if ($bg_color == 1) {
208
                            $this->doc->setColor(0.8, 0.8, 0.8);
209
                            $this->doc->filledRectangle($this->doc->get("margin_left"), $this->doc->get('y') - $this->doc->get("font_spacing"), $this->doc->get('right_margin_position') - $this->doc->get("margin_left"), $this->doc->get("font_spacing"));
210
                            $this->doc->setColor(0, 0, 0);
211
                        }
212
                        $this->doc->setY('-'.$this->doc->get("font_spacing"));
213
                        if ($this->doc->get('y') < $this->doc->get("margin_bottom") + $this->doc->get("font_spacing") * 2) {
214
                            $this->doc->nextPage(true);
@@ 218-222 (lines=5) @@
215
                        }
216
                    } else {
217
                        while ($line != "") {
218
                            if ($bg_color == 1) {
219
                                $this->doc->setColor(0.8, 0.8, 0.8);
220
                                $this->doc->filledRectangle($this->doc->get("margin_left"), $this->doc->get('y') - $this->doc->get("font_spacing"), $this->doc->get('right_margin_position') - $this->doc->get("margin_left"), $this->doc->get("font_spacing"));
221
                                $this->doc->setColor(0, 0, 0);
222
                            }
223
224
                            $this->doc->setY('-'.($this->doc->get("font_padding_top") + $this->doc->get("font_size")));
225
                            $line = $this->doc->addTextWrap($apointX["tekst"], $this->doc->get('y') + 1, $apointX["tekst_width"], $this->doc->get("font_size"), $line); // Ups Ups, hvor kommer '+ 1' fra - jo ser du, ellers kappes det nederste af teksten!
@@ 246-250 (lines=5) @@
243
244
                ($bg_color == 1) ? $bg_color = 0 : $bg_color = 1;
245
246
                if ($bg_color == 1) {
247
                    $this->doc->setColor(0.8, 0.8, 0.8);
248
                    $this->doc->filledRectangle($this->doc->get("margin_left"), $this->doc->get('y') - $this->doc->get("font_spacing"), $this->doc->get('right_margin_position') - $this->doc->get("margin_left"), $this->doc->get("font_spacing"));
249
                    $this->doc->setColor(0, 0, 0);
250
                }
251
252
                $this->doc->setLineStyle(0.5);
253
                $this->doc->line($this->doc->get("margin_left"), $this->doc->get('y'), $this->doc->get('right_margin_position'), $this->doc->get('y'));