1: <?php
2:
3: 4: 5: 6: 7: 8:
9:
10: namespace XSLTBenchmarking\TestsGenerator;
11:
12: require_once LIBS . '/PhpPath/PhpPath.min.php';
13: require_once ROOT . '/DriversContainer.php';
14:
15: use PhpPath\P;
16:
17: 18: 19: 20: 21:
22: class XmlGenerator extends \XSLTBenchmarking\DriversContainer
23: {
24:
25:
26: 27: 28: 29: 30: 31: 32: 33:
34: public function generate($outputPath, $templateDir, array $settings)
35: {
36: $omitXmlDeclaration = FALSE;
37: if (isset($settings['omitXmlDeclaration']))
38: {
39: if ($settings['omitXmlDeclaration'] == 1)
40: {
41: $omitXmlDeclaration = TRUE;
42: }
43: unset($settings['omitXmlDeclaration']);
44: }
45:
46: $this->driver->generate($outputPath, $templateDir, $settings);
47:
48: if ($omitXmlDeclaration)
49: {
50: $output = file_get_contents($outputPath);
51: $output = preg_replace('/<\?xml[^?]+\?>/', '', $output);
52: file_put_contents($outputPath, $output);
53: }
54: }
55:
56:
57: }
58: