Code Duplication    Length = 16-16 lines in 2 locations

web_interface/astpp/application/libraries/html2pdf/html2pdf.php 2 locations

@@ 2135-2150 (lines=16) @@
2132
            }
2133
2134
            // for each cell with colspan, we adapt the width of each column
2135
            for ($x = 0; $x < count($corr[0]); $x++) {
2136
                for ($y = 0; $y < count($corr); $y++) {
2137
                    if (isset($corr[$y][$x]) && is_array($corr[$y][$x]) && $corr[$y][$x][2] > 1) {
2138
2139
                        // sum the max width of each column in colspan
2140
                        $s = 0; for ($i = 0; $i < $corr[$y][$x][2]; $i++) $s += $sw[$x + $i];
2141
2142
                        // if the max width is < the width of the cell with colspan => we adapt the width of each max width
2143
                        if ($s > 0 && $s < $cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['w']) {
2144
                            for ($i = 0; $i < $corr[$y][$x][2]; $i++) {
2145
                                $sw[$x + $i] = $sw[$x + $i] / $s * $cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['w'];
2146
                            }
2147
                        }
2148
                    }
2149
                }
2150
            }
2151
2152
            // set the new width, for each cell
2153
            for ($x = 0; $x < count($corr[0]); $x++) {
@@ 2184-2199 (lines=16) @@
2181
            }
2182
2183
            // for each cell with rowspan, we adapt the height of each line
2184
            for ($y = 0; $y < count($corr); $y++) {
2185
                for ($x = 0; $x < count($corr[0]); $x++) {
2186
                    if (isset($corr[$y][$x]) && is_array($corr[$y][$x]) && $corr[$y][$x][3] > 1) {
2187
2188
                        // sum the max height of each line in rowspan
2189
                        $s = 0; for ($i = 0; $i < $corr[$y][$x][3]; $i++) $s += $sh[$y + $i];
2190
2191
                        // if the max height is < the height of the cell with rowspan => we adapt the height of each max height
2192
                        if ($s > 0 && $s < $cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['h']) {
2193
                            for ($i = 0; $i < $corr[$y][$x][3]; $i++) {
2194
                                $sh[$y + $i] = $sh[$y + $i] / $s * $cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['h'];
2195
                            }
2196
                        }
2197
                    }
2198
                }
2199
            }
2200
2201
            // set the new height, for each cell
2202
            for ($y = 0; $y < count($corr); $y++) {