Code Duplication    Length = 9-9 lines in 2 locations

src/PhpSpreadsheet/Reader/BaseReader.php 1 location

@@ 253-261 (lines=9) @@
250
     * @param     string         $xml
251
     * @throws Exception
252
     */
253
    public function securityScan($xml)
254
    {
255
        $pattern = '/\\0?' . implode('\\0?', str_split('<!DOCTYPE')) . '\\0?/';
256
        if (preg_match($pattern, $xml)) {
257
            throw new Exception('Detected use of ENTITY in XML, spreadsheet file load() aborted to prevent XXE/XEE attacks');
258
        }
259
260
        return $xml;
261
    }
262
263
    /**
264
     * Scan theXML for use of <!ENTITY to prevent XXE/XEE attacks

src/PhpSpreadsheet/Reader/HTML.php 1 location

@@ 557-565 (lines=9) @@
554
     * @param     string         $xml
555
     * @throws Exception
556
     */
557
    public function securityScan($xml)
558
    {
559
        $pattern = '/\\0?' . implode('\\0?', str_split('<!ENTITY')) . '\\0?/';
560
        if (preg_match($pattern, $xml)) {
561
            throw new Exception('Detected use of ENTITY in XML, spreadsheet file load() aborted to prevent XXE/XEE attacks');
562
        }
563
564
        return $xml;
565
    }
566
}
567