1: <?php
2:
3: /**
4: * XSLT Benchmarking
5: * @link https://github.com/masicek/XSLT-Benchmarking
6: * @author Viktor Mašíček <viktor@masicek.net>
7: * @license "New" BSD License
8: */
9:
10: namespace XSLTBenchmarking\TestsGenerator;
11:
12: require_once LIBS . '/PhpPath/PhpPath.min.php';
13: require_once __DIR__ . '/ITemplatingDriver.php';
14: require_once ROOT . '/Exceptions.php';
15:
16:
17: use PhpPath\P;
18:
19: /**
20: * Simple templating - only copy input file into output file.
21: *
22: * @author Viktor Mašíček <viktor@masicek.net>
23: */
24: class SimpleTemplatingDriver implements ITemplatingDriver
25: {
26:
27:
28: /**
29: * Object configuration
30: *
31: * @param string $tmpDirectory The path of the temporary directory
32: */
33: public function __construct($tmpDirectory)
34: {
35: }
36:
37:
38: /**
39: * Copy input file into output file
40: *
41: * @param string $templatePath Path of file to copy
42: * @param string $outputPath Path output file
43: * @param array $settings Settings are not use in this driver
44: *
45: * @throws \XSLTBenchmarking\GenerateTemplateException Problem with generating
46: * @return void
47: */
48: public function generate($templatePath, $outputPath, array $settings = array())
49: {
50: P::cf($templatePath);
51:
52: if (!copy($templatePath, $outputPath))
53: {// @codeCoverageIgnoreStart
54: throw new \XSLTBenchmarking\GenerateTemplateException('Cannot create file "' . $outputFile . '".');
55: }// @codeCoverageIgnoreEnd
56: }
57:
58:
59: }
60: