1 | <?php |
||
29 | abstract class AbstractDevice |
||
30 | { |
||
31 | /** |
||
32 | * Use command line options |
||
33 | */ |
||
34 | use CommandLineOptionsTrait; |
||
35 | |||
36 | /** |
||
37 | * Use rendering parameters |
||
38 | */ |
||
39 | use RenderingTrait; |
||
40 | |||
41 | /** |
||
42 | 15 | * Use page parameters |
|
43 | */ |
||
44 | 15 | use PageTrait; |
|
45 | 15 | ||
46 | 15 | /** |
|
47 | * Use font-related parameters |
||
48 | */ |
||
49 | use FontTrait; |
||
50 | |||
51 | /** |
||
52 | * Use resource-related parameters |
||
53 | */ |
||
54 | use ResourceTrait; |
||
55 | 6 | ||
56 | /** |
||
57 | 6 | * Use interaction parameters |
|
58 | */ |
||
59 | use InteractionTrait; |
||
60 | |||
61 | /** |
||
62 | * Use device and output selection parameters |
||
63 | */ |
||
64 | use OutputSelectionTrait; |
||
65 | |||
66 | /** |
||
67 | 3 | * Use EPS parameters |
|
68 | */ |
||
69 | 3 | use EpsTrait; |
|
70 | 3 | ||
71 | 3 | /** |
|
72 | * Use ICC color parameters |
||
73 | */ |
||
74 | 3 | use IccColorTrait; |
|
75 | |||
76 | /** |
||
77 | * Use other parameters |
||
78 | */ |
||
79 | use OtherTrait; |
||
80 | |||
81 | /** |
||
82 | * PostScript commands to be executed via command line when using this device. |
||
83 | */ |
||
84 | 3 | const POSTSCRIPT_COMMANDS = ''; |
|
85 | |||
86 | 3 | /** |
|
87 | * The process builder object |
||
88 | 3 | * |
|
89 | * @var ProcessBuilder |
||
90 | */ |
||
91 | private $builder; |
||
92 | |||
93 | /** |
||
94 | * The arguments object |
||
95 | * |
||
96 | * @var ProcessArguments |
||
97 | */ |
||
98 | private $arguments; |
||
99 | |||
100 | 6 | /** |
|
101 | * List of input files |
||
102 | 6 | * |
|
103 | 3 | * @var array |
|
104 | */ |
||
105 | private $inputFiles = []; |
||
106 | 3 | ||
107 | 3 | /** |
|
108 | * Whether to read input from stdin |
||
109 | 3 | * |
|
110 | * @var bool |
||
111 | */ |
||
112 | private $inputStdin = false; |
||
113 | |||
114 | /** |
||
115 | * Create abstract device object |
||
116 | * |
||
117 | * @param ProcessBuilder $builder |
||
118 | * @param ProcessArguments $arguments |
||
119 | */ |
||
120 | public function __construct(ProcessBuilder $builder, ProcessArguments $arguments) |
||
125 | |||
126 | /** |
||
127 | * Get Argument |
||
128 | * |
||
129 | * @param string $name |
||
130 | * |
||
131 | * @return null|ProcessArgument |
||
132 | */ |
||
133 | protected function getArgument($name) |
||
137 | |||
138 | /** |
||
139 | * Whether argument is set |
||
140 | * |
||
141 | * @param string $name |
||
142 | * |
||
143 | * @return bool |
||
144 | */ |
||
145 | protected function hasArgument($name) |
||
149 | |||
150 | /** |
||
151 | * Get argument value |
||
152 | * |
||
153 | * @param string $name |
||
154 | * |
||
155 | * @return null|string |
||
156 | */ |
||
157 | protected function getArgumentValue($name) |
||
166 | |||
167 | /** |
||
168 | * Set argument |
||
169 | * |
||
170 | * @param string $argument |
||
171 | * |
||
172 | * @return $this |
||
173 | */ |
||
174 | protected function setArgument($argument) |
||
180 | |||
181 | /** |
||
182 | * Set a generic command line parameter with a string value |
||
183 | * |
||
184 | * @param string $param the parameter name |
||
185 | * @param string $value the parameter value |
||
186 | * |
||
187 | * @return $this |
||
188 | */ |
||
189 | public function setStringParameter($param, $value) |
||
195 | |||
196 | /** |
||
197 | * Set a generic command line parameter with a token value |
||
198 | * |
||
199 | * @param string $param the parameter name |
||
200 | * @param mixed $value the parameter value |
||
201 | * |
||
202 | * @return $this |
||
203 | */ |
||
204 | public function setTokenParameter($param, $value) |
||
210 | |||
211 | /** |
||
212 | * Add an input file |
||
213 | * |
||
214 | * @param string $inputFile a path to an existing file |
||
215 | * |
||
216 | * @throws \RuntimeException if $inputFile does not exist |
||
217 | * |
||
218 | * @return $this |
||
219 | */ |
||
220 | public function addInputFile($inputFile) |
||
229 | |||
230 | /** |
||
231 | * Add an stdin as input file |
||
232 | * |
||
233 | * @return $this |
||
234 | */ |
||
235 | public function addInputStdin() |
||
241 | |||
242 | /** |
||
243 | * Create process object |
||
244 | * |
||
245 | * @param string $inputFile either a path to an existing file or a dash (-) to read input from stdin |
||
246 | * |
||
247 | * @throws \RuntimeException if $inputFile does not exist |
||
248 | * |
||
249 | * @return Process |
||
250 | */ |
||
251 | public function createProcess($inputFile = null) |
||
271 | |||
272 | /** |
||
273 | * Reset the input-related fields of this device. |
||
274 | * Future processes created from this device will have their own input parameters. |
||
275 | */ |
||
276 | private function resetInput() |
||
281 | } |
||
282 |