1 | <?php |
||
22 | abstract class AbstractDevice |
||
23 | { |
||
24 | /** |
||
25 | * Use command line options. |
||
26 | */ |
||
27 | use CommandLineParametersTrait; |
||
28 | |||
29 | /** |
||
30 | * Use rendering parameters. |
||
31 | */ |
||
32 | use CommandLineParameters\RenderingTrait; |
||
33 | |||
34 | /** |
||
35 | * Use page parameters. |
||
36 | */ |
||
37 | use CommandLineParameters\PageTrait; |
||
38 | |||
39 | /** |
||
40 | * Use font-related parameters. |
||
41 | */ |
||
42 | use CommandLineParameters\FontTrait; |
||
43 | |||
44 | /** |
||
45 | * Use resource-related parameters. |
||
46 | */ |
||
47 | use CommandLineParameters\ResourceTrait; |
||
48 | |||
49 | /** |
||
50 | * Use interaction parameters. |
||
51 | */ |
||
52 | use CommandLineParameters\InteractionTrait; |
||
53 | |||
54 | /** |
||
55 | * Use device and output selection parameters. |
||
56 | */ |
||
57 | use CommandLineParameters\OutputSelectionTrait; |
||
58 | |||
59 | /** |
||
60 | * Use EPS parameters. |
||
61 | */ |
||
62 | use CommandLineParameters\EpsTrait; |
||
63 | |||
64 | /** |
||
65 | * Use ICC color parameters. |
||
66 | */ |
||
67 | use CommandLineParameters\IccColorTrait; |
||
68 | |||
69 | /** |
||
70 | * Use other parameters. |
||
71 | */ |
||
72 | use CommandLineParameters\OtherTrait; |
||
73 | |||
74 | /** |
||
75 | * The Ghostscript object. |
||
76 | * |
||
77 | * @var Ghostscript |
||
78 | */ |
||
79 | private $ghostscript; |
||
80 | |||
81 | /** |
||
82 | * The arguments object. |
||
83 | * |
||
84 | * @var Arguments |
||
85 | */ |
||
86 | private $arguments; |
||
87 | |||
88 | /** |
||
89 | * Create abstract device object. |
||
90 | * |
||
91 | * @param Ghostscript $ghostscript |
||
92 | * @param Arguments $arguments |
||
93 | */ |
||
94 | 20 | public function __construct(Ghostscript $ghostscript, Arguments $arguments) |
|
99 | |||
100 | /** |
||
101 | * Get argument. |
||
102 | * |
||
103 | * @param string $name |
||
104 | * |
||
105 | * @return null|Argument |
||
106 | */ |
||
107 | 6 | protected function getArgument($name) |
|
111 | |||
112 | /** |
||
113 | * Whether argument is set. |
||
114 | * |
||
115 | * @param string $name |
||
116 | * |
||
117 | * @return bool |
||
118 | */ |
||
119 | 2 | protected function hasArgument($name) |
|
123 | |||
124 | /** |
||
125 | * Get argument value. |
||
126 | * |
||
127 | * @param string $name |
||
128 | * |
||
129 | * @return null|string |
||
130 | */ |
||
131 | 2 | protected function getArgumentValue($name) |
|
140 | |||
141 | /** |
||
142 | * Set argument. |
||
143 | * |
||
144 | * @param string $argument |
||
145 | * |
||
146 | * @return $this |
||
147 | */ |
||
148 | 2 | protected function setArgument($argument) |
|
154 | |||
155 | /** |
||
156 | * Sanitize input. |
||
157 | * |
||
158 | * @param null|string|resource|Input $input |
||
159 | * |
||
160 | * @return Input |
||
161 | */ |
||
162 | 12 | protected function sanitizeInput($input) |
|
184 | |||
185 | /** |
||
186 | * Create process arguments. |
||
187 | * |
||
188 | * @param Input $input |
||
189 | * |
||
190 | * @throws \RuntimeException |
||
191 | * |
||
192 | * @return array |
||
193 | */ |
||
194 | 12 | protected function createProcessArguments(Input $input) |
|
219 | |||
220 | /** |
||
221 | * Create process builder. |
||
222 | * |
||
223 | * @param array $arguments |
||
224 | * @param Input $input |
||
225 | * |
||
226 | * @return ProcessBuilder |
||
227 | */ |
||
228 | 10 | protected function createProcessBuilder(array $arguments, Input $input) |
|
239 | |||
240 | /** |
||
241 | * Create process object. |
||
242 | * |
||
243 | * @param null|string|resource|Input $input |
||
244 | * |
||
245 | * @throws \RuntimeException |
||
246 | * |
||
247 | * @return Process |
||
248 | */ |
||
249 | 12 | public function createProcess($input = null) |
|
257 | } |
||
258 |