diff options
| author | Greg Roach <fisharebest@webtrees.net> | 2018-10-06 19:17:01 +0100 |
|---|---|---|
| committer | Greg Roach <fisharebest@webtrees.net> | 2018-10-06 21:08:30 +0100 |
| commit | 8a4ee39c672840ee75fccd3fa23578043bf2590c (patch) | |
| tree | ecac1d4efd4d762c398aed196c488923b4c6927f /app/Report/ReportParserBase.php | |
| parent | e33d66762436a8bb1ed10d6d6d0f23bb8f2f0fe3 (diff) | |
| download | webtrees-8a4ee39c672840ee75fccd3fa23578043bf2590c.tar.gz webtrees-8a4ee39c672840ee75fccd3fa23578043bf2590c.tar.bz2 webtrees-8a4ee39c672840ee75fccd3fa23578043bf2590c.zip | |
PHPdoc
Diffstat (limited to 'app/Report/ReportParserBase.php')
| -rw-r--r-- | app/Report/ReportParserBase.php | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/app/Report/ReportParserBase.php b/app/Report/ReportParserBase.php index d3ee05f02e..a9973c1e89 100644 --- a/app/Report/ReportParserBase.php +++ b/app/Report/ReportParserBase.php @@ -18,8 +18,6 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Report; use DomainException; -use Fisharebest\Webtrees\Tree; -use function method_exists; /** * Class ReportParserBase @@ -40,20 +38,28 @@ class ReportParserBase public function __construct(string $report) { $this->xml_parser = xml_parser_create(); + xml_parser_set_option($this->xml_parser, XML_OPTION_CASE_FOLDING, false); - xml_set_element_handler($this->xml_parser, [ - $this, - 'startElement', - ], [ - $this, - 'endElement', - ]); - xml_set_character_data_handler($this->xml_parser, [ - $this, - 'characterData', - ]); + + xml_set_element_handler( + $this->xml_parser, + function ($parser, string $name, array $attrs) { + $this->startElement($parser, $name, $attrs); + }, + function ($parser, string $name) { + $this->endElement($parser, $name); + } + ); + + xml_set_character_data_handler( + $this->xml_parser, + function ($parser, $data) { + $this->characterData($parser, $data); + } + ); $fp = fopen($report, 'r'); + while (($data = fread($fp, 4096))) { if (!xml_parse($this->xml_parser, $data, feof($fp))) { throw new DomainException(sprintf( |
