Overview
Namespaces
Classes
- AMemoryUsageDriver
- AProcessorDriver
- Controlor
- Libxslt1123phpProcessorDriver
- Libxslt1126phpProcessorDriver
- LinuxMemoryUsageDriver
- MemoryUsage
- MSXML30ProcessorDriver
- MSXML60ProcessorDriver
- Params
- Processor
- Runner
- Sablotron103cmdProcessorDriver
- Saxon655ProcessorDriver
- SaxonHE9402ProcessorDriver
- Test
- TestRunner
- WindowsMemoryUsageDriver
- Xalan271ProcessorDriver
- XmlParamsDriver
- Xsltproc1123ProcessorDriver
- Xsltproc1126ProcessorDriver
- XT20051206ProcessorDriver
Interfaces
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\TestsRunner;
11:
12: require_once ROOT . '/Exceptions.php';
13:
14: /**
15: * Abstract class for coleting information about one processor
16: * and making command template for their running
17: *
18: * @author Viktor Mašíček <viktor@masicek.net>
19: */
20: abstract class AProcessorDriver
21: {
22:
23: /**
24: * Saxon kernel names
25: */
26: const KERNEL_SAXON = 'Saxon';
27: const KERNEL_LIBXSLT = 'libxslt';
28: const KERNEL_SABLOTRON = 'Sablotron';
29: const KERNEL_XALAN = 'Xalan';
30: const KERNEL_XT = 'XT';
31: const KERNEL_MSXML = 'MSXML';
32:
33: /**
34: * Value of PHP_OS for Windows
35: */
36: const OS_WIN = 'WINNT';
37:
38: /**
39: * Value of PHP_OS for Linux
40: */
41: const OS_LINUX = 'Linux';
42:
43:
44: /**
45: * Short name of the processor
46: *
47: * @return string
48: */
49: public function getName()
50: {
51: $className = get_class($this);
52: $start = strrpos($className, '\\') + 1;
53: $name = substr($className, $start, -15);
54: return strtolower($name);
55: }
56:
57:
58: /**
59: * Return information about processor
60: *
61: * @return array
62: */
63: public function getInformations()
64: {
65: return array(
66: 'fullName' => $this->getFullName(),
67: 'kernel' => $this->getKernel(),
68: );
69: }
70:
71:
72: /**
73: * Preparing command template for transformation, that are not include in measured time.
74: *
75: * Templates substitutions:
76: * [XSLT] = path of XSLT template for transformation
77: * [INPUT] = path of input XML file
78: * [OUTPUT] = path of generated output XML file
79: * [ERROR] = path of file for eventual generated error message
80: * [PROCESSORS] = path of directory containing XSLT processors (libraries, command-line program etc.)
81: * [LIBS] = path of Libs directory
82: *
83: * @return string
84: */
85: public function getBeforeCommandTemplate()
86: {
87: return '';
88: }
89:
90:
91: /**
92: * Concluding command template for transformation, that are not include in measured time.
93: *
94: * Templates substitutions:
95: * [XSLT] = path of XSLT template for transformation
96: * [INPUT] = path of input XML file
97: * [OUTPUT] = path of generated output XML file
98: * [ERROR] = path of file for eventual generated error message
99: * [PROCESSORS] = path of directory containing XSLT processors (libraries, command-line program etc.)
100: * [LIBS] = path of Libs directory
101: *
102: * @return string
103: */
104: public function getAfterCommandTemplate()
105: {
106: return '';
107: }
108:
109:
110: /**
111: * Flag, if template for transformating has to be set in input XML
112: * by directive "<?xml-stylesheet href="[XSLT]" type="text/xml" ..."
113: *
114: * @return bool
115: */
116: public function isTemplateSetInInput()
117: {
118: return FALSE;
119: }
120:
121:
122: /**
123: * Return flag, if the driver is available.
124: * For example, it can be used for distinguish OS.
125: *
126: * @return bool
127: */
128: abstract public function isAvailable();
129:
130:
131: /**
132: * Return template of command
133: *
134: * Templates substitutions:
135: * [XSLT] = path of XSLT template for transformation
136: * [INPUT] = path of input XML file
137: * [OUTPUT] = path of generated output XML file
138: * [ERROR] = path of file for eventual generated error message
139: * [PROCESSORS] = path of directory containing XSLT processors (libraries, command-line program etc.)
140: * [LIBS] = path of Libs directory
141: *
142: * @return string
143: */
144: abstract public function getCommandTemplate();
145:
146:
147: /**
148: * Full name of processor (with version)
149: *
150: * @return string
151: */
152: abstract public function getFullName();
153:
154:
155: /**
156: * Return name of processor kernel.
157: * Available kernels are const of this class with prefix "KERNEL_"
158: *
159: * Examples:
160: * Saxon 6.5.5 -> Saxon
161: * xsltproc -> libxslt
162: *
163: * @return string
164: */
165: abstract public function getKernel();
166:
167:
168: }
169: