Code Duplication    Length = 21-21 lines in 2 locations

class/mvc-view.php 1 location

@@ 514-534 (lines=21) @@
511
	 * @param string	&$html
512
	 * @return string
513
	 */
514
	public function Tidy (&$html) {
515
		if (true == class_exists("tidy")) {
516
			// Specify configuration
517
			$config = array(
518
				'doctype'		=> 'strict',
519
				'indent'		=> true,
520
				'indent-spaces'	=> 2,
521
				'output-xhtml'	=> true,
522
				'wrap'			=> 200
523
			);
524
			// Do tidy
525
			$tidy = new tidy;
526
			$tidy->parseString($html, $config, 'utf8');
527
			$tidy->cleanRepair();
528
529
			return tidy_get_output($tidy);
530
		} else {
531
			$this->Log('Tidy is not installed !', 4);
532
			return $html;
533
		}
534
	} // end of func Tidy
535
536
} // end of class View
537
?>

src/Fwlib/Web/Helper/TidyTrait.php 1 location

@@ 19-39 (lines=21) @@
16
     * @param   string  $html
17
     * @return  string
18
     */
19
    protected function tidy($html)
20
    {
21
        if (!extension_loaded('tidy')) {
22
            throw (new ExtensionNotLoadedException)->setExtension('tidy');
23
24
        } else {
25
            $config = [
26
                'doctype'       => 'strict',
27
                'indent'        => true,
28
                'indent-spaces' => 2,
29
                'output-xhtml'  => true,
30
                'wrap'          => 200
31
            ];
32
33
            $tidy = new tidy;
34
            $tidy->parseString($html, $config, 'utf8');
35
            $tidy->cleanRepair();
36
37
            return tidy_get_output($tidy);
38
        }
39
    }
40
}
41