Code Duplication    Length = 38-39 lines in 2 locations

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

@@ 6347-6384 (lines=38) @@
6344
         * @param  array $param
6345
         * @return boolean|null
6346
         */
6347
        protected function _tag_open_POLYLINE($param)
6348
        {
6349
            if ( ! $this->_isInDraw) throw new HTML2PDF_exception(8, 'POLYGON');
6350
6351
            $this->pdf->doTransform(isset($param['transform']) ? $this->_prepareTransform($param['transform']) : null);
6352
            $this->parsingCss->save();
6353
            $styles = $this->parsingCss->getSvgStyle('path', $param);
6354
            $style = $this->pdf->svgSetStyle($styles);
6355
6356
            $path = isset($param['points']) ? $param['points'] : null;
6357
            if ($path) {
6358
                $path = str_replace(',', ' ', $path);
6359
                $path = preg_replace('/[\s]+/', ' ', trim($path));
6360
6361
                // prepare the path
6362
                $path = explode(' ', $path);
6363
                foreach ($path as $k => $v) {
6364
                    $path[$k] = trim($v);
6365
                    if ($path[$k] === '') unset($path[$k]);
6366
                }
6367
                $path = array_values($path);
6368
6369
                $actions = array();
6370
                for ($k = 0; $k < count($path); $k += 2) {
6371
                    $actions[] = array(
6372
                        ($k ? 'L' : 'M'),
6373
                        $this->parsingCss->ConvertToMM($path[$k + 0], $this->_isInDraw['w']),
6374
                        $this->parsingCss->ConvertToMM($path[$k + 1], $this->_isInDraw['h'])
6375
                    );
6376
                }
6377
6378
                // drawing
6379
                $this->pdf->svgPolygone($actions, $style);
6380
            }
6381
6382
            $this->pdf->undoTransform();
6383
            $this->parsingCss->load();
6384
        }
6385
6386
        /**
6387
         * tag : POLYGON
@@ 6393-6431 (lines=39) @@
6390
         * @param  array $param
6391
         * @return boolean|null
6392
         */
6393
        protected function _tag_open_POLYGON($param)
6394
        {
6395
            if ( ! $this->_isInDraw) throw new HTML2PDF_exception(8, 'POLYGON');
6396
6397
            $this->pdf->doTransform(isset($param['transform']) ? $this->_prepareTransform($param['transform']) : null);
6398
            $this->parsingCss->save();
6399
            $styles = $this->parsingCss->getSvgStyle('path', $param);
6400
            $style = $this->pdf->svgSetStyle($styles);
6401
6402
            $path = (isset($param['points']) ? $param['points'] : null);
6403
            if ($path) {
6404
                $path = str_replace(',', ' ', $path);
6405
                $path = preg_replace('/[\s]+/', ' ', trim($path));
6406
6407
                // prepare the path
6408
                $path = explode(' ', $path);
6409
                foreach ($path as $k => $v) {
6410
                    $path[$k] = trim($v);
6411
                    if ($path[$k] === '') unset($path[$k]);
6412
                }
6413
                $path = array_values($path);
6414
6415
                $actions = array();
6416
                for ($k = 0; $k < count($path); $k += 2) {
6417
                    $actions[] = array(
6418
                        ($k ? 'L' : 'M'),
6419
                        $this->parsingCss->ConvertToMM($path[$k + 0], $this->_isInDraw['w']),
6420
                        $this->parsingCss->ConvertToMM($path[$k + 1], $this->_isInDraw['h'])
6421
                    );
6422
                }
6423
                $actions[] = array('z');
6424
6425
                // drawing
6426
                $this->pdf->svgPolygone($actions, $style);
6427
            }
6428
6429
            $this->pdf->undoTransform();
6430
            $this->parsingCss->load();
6431
        }
6432
6433
        /**
6434
         * tag : PATH