1 | <?php |
||
17 | trait InteractionTrait |
||
18 | { |
||
19 | /** |
||
20 | * Whether argument is set |
||
21 | * |
||
22 | * @param string $name |
||
23 | * |
||
24 | * @return bool |
||
25 | */ |
||
26 | abstract protected function hasArgument($name); |
||
27 | |||
28 | /** |
||
29 | * Get argument value |
||
30 | * |
||
31 | * @param string $name |
||
32 | * |
||
33 | * @return null|string |
||
34 | */ |
||
35 | abstract protected function getArgumentValue($name); |
||
36 | |||
37 | /** |
||
38 | * Set argument |
||
39 | * |
||
40 | * @param string $argument |
||
41 | * |
||
42 | * @return $this |
||
43 | */ |
||
44 | abstract protected function setArgument($argument); |
||
45 | |||
46 | /** |
||
47 | * Whether BATCH flag is set |
||
48 | * |
||
49 | * @return bool |
||
50 | */ |
||
51 | 2 | public function isBatch() |
|
55 | |||
56 | /** |
||
57 | * Set BATCH flag |
||
58 | * |
||
59 | * Causes Ghostscript to exit after processing all files named on the command line, rather than going into an |
||
60 | * interactive loop reading PostScript commands. Equivalent to putting -c quit at the end of the command line. |
||
61 | * |
||
62 | * @return $this |
||
63 | */ |
||
64 | 2 | public function setBatch() |
|
70 | |||
71 | /** |
||
72 | * Whether NOPAGEPROMPT flag is set |
||
73 | * |
||
74 | * @return bool |
||
75 | */ |
||
76 | 2 | public function isNoPagePrompt() |
|
80 | |||
81 | /** |
||
82 | * Set NOPAGEPROMPT flag |
||
83 | * |
||
84 | * Disables only the prompt, but not the pause, at the end of each page. This may be useful on PC displays that get |
||
85 | * confused if a program attempts to write text to the console while the display is in a graphics mode. |
||
86 | * |
||
87 | * @return $this |
||
88 | */ |
||
89 | 2 | public function setNoPagePrompt() |
|
95 | |||
96 | /** |
||
97 | * Whether NOPAUSE flag is set |
||
98 | * |
||
99 | * @return bool |
||
100 | */ |
||
101 | 2 | public function isNoPause() |
|
105 | |||
106 | /** |
||
107 | * Set NOPAUSE flag |
||
108 | * |
||
109 | * Disables the prompt and pause at the end of each page. Normally one should use this (along with -dBATCH) when |
||
110 | * producing output on a printer or to a file; it also may be desirable for applications where another program is |
||
111 | * "driving" Ghostscript. |
||
112 | * |
||
113 | * @return $this |
||
114 | */ |
||
115 | 2 | public function setNoPause() |
|
121 | |||
122 | /** |
||
123 | * Whether NOPROMPT flag is set |
||
124 | * |
||
125 | * @return bool |
||
126 | */ |
||
127 | 2 | public function isNoPrompt() |
|
131 | |||
132 | /** |
||
133 | * Set NOPROMPT flag |
||
134 | * |
||
135 | * Disables the prompt printed by Ghostscript when it expects interactive input, as well as the end-of-page prompt |
||
136 | * (-dNOPAGEPROMPT). This allows piping input directly into Ghostscript, as long as the data doesn't refer to |
||
137 | * currentfile. |
||
138 | * |
||
139 | * @return $this |
||
140 | */ |
||
141 | 2 | public function setNoPrompt() |
|
147 | |||
148 | /** |
||
149 | * Whether QUIET flag is set |
||
150 | * |
||
151 | * @return bool |
||
152 | */ |
||
153 | 2 | public function isQuiet() |
|
157 | |||
158 | /** |
||
159 | * Set QUIET flag |
||
160 | * |
||
161 | * Suppresses routine information comments on standard output. This is currently necessary when redirecting device |
||
162 | * output to standard output. |
||
163 | * |
||
164 | * @return $this |
||
165 | */ |
||
166 | 2 | public function setQuiet() |
|
172 | |||
173 | /** |
||
174 | * Whether SHORTERRORS flag is set |
||
175 | * |
||
176 | * @return bool |
||
177 | */ |
||
178 | 2 | public function isShortErrors() |
|
182 | |||
183 | /** |
||
184 | * Set SHORTERRORS flag |
||
185 | * |
||
186 | * Makes certain error and information messages more Adobe-compatible. |
||
187 | * |
||
188 | * @return $this |
||
189 | */ |
||
190 | 2 | public function setShortErrors() |
|
196 | |||
197 | /** |
||
198 | * Get value of stdout parameter if set |
||
199 | * |
||
200 | * @return string|null |
||
201 | */ |
||
202 | 2 | public function getStdout() |
|
206 | |||
207 | /** |
||
208 | * Set stdout parameter |
||
209 | * |
||
210 | * Redirect PostScript %stdout to a file or stderr, to avoid it being mixed with device stdout. To redirect stdout |
||
211 | * to stderr use -sstdout=%stderr. To cancel redirection of stdout use -sstdout=%stdout or -sstdout=-. |
||
212 | * |
||
213 | * Note that this redirects PostScript output to %stdout but does not change the destination FILE of device output |
||
214 | * as with -sOutputFile=- or even -sOutputFile=%stdout since devices write directly using the stdout FILE * pointer |
||
215 | * with C function calls such as fwrite or fputs. |
||
216 | * |
||
217 | * @param string $filename file to redirect PostScript %stdout to |
||
218 | * |
||
219 | * @return $this |
||
220 | */ |
||
221 | 2 | public function setStdout($filename) |
|
227 | |||
228 | /** |
||
229 | * Whether TTYPAUSE flag is set |
||
230 | * |
||
231 | * @return bool |
||
232 | */ |
||
233 | 2 | public function isTtyPause() |
|
237 | |||
238 | /** |
||
239 | * Set TTYPAUSE flag |
||
240 | * |
||
241 | * Causes Ghostscript to read a character from /dev/tty, rather than standard input, at the end of each page. This |
||
242 | * may be useful if input is coming from a pipe. Note that -dTTYPAUSE overrides -dNOPAUSE. Also note that -dTTYPAUSE |
||
243 | * requires opening the terminal device directly, and may cause problems in combination with -dSAFER. Permission |
||
244 | * errors can be avoided by adding the device to the permitted reading list before invoking safer mode. For example: |
||
245 | * gs -dTTYPAUSE -dDELAYSAFER -c '<< /PermitFileReading [ (/dev/tty)] >> setuserparams .locksafe' -dSAFER |
||
246 | * |
||
247 | * @return $this |
||
248 | */ |
||
249 | 2 | public function setTtyPause() |
|
255 | } |
||
256 |