1 | <?php |
||
12 | class SeleniumProcess implements SeleniumProcessInterface |
||
13 | { |
||
14 | /** |
||
15 | * @var array |
||
16 | */ |
||
17 | protected $args = []; |
||
18 | |||
19 | /** |
||
20 | * @var resource |
||
21 | */ |
||
22 | protected $process = null; |
||
23 | |||
24 | /** |
||
25 | * @var array |
||
26 | */ |
||
27 | protected $pipes = []; |
||
28 | |||
29 | public function __construct() |
||
32 | |||
33 | /** |
||
34 | * {@inheritdoc} |
||
35 | * |
||
36 | * @param BinaryInterface $binary |
||
37 | * @param string $directory |
||
38 | * @return void |
||
39 | */ |
||
40 | public function addBinary(BinaryInterface $binary, $directory) |
||
57 | |||
58 | private function pathContains($path, $match) |
||
62 | |||
63 | |||
64 | /** |
||
65 | * {@inheritdoc} |
||
66 | * |
||
67 | * @return array |
||
68 | */ |
||
69 | public function getArgs() |
||
73 | |||
74 | /** |
||
75 | * {@inheritdoc} |
||
76 | * |
||
77 | * @param string $arg |
||
78 | * @return void |
||
79 | */ |
||
80 | public function addArg($arg) |
||
88 | |||
89 | /** |
||
90 | * {@inheritdoc} |
||
91 | * |
||
92 | * @param array $args |
||
93 | * @return void |
||
94 | */ |
||
95 | public function addArgs(array $args) |
||
101 | |||
102 | /** |
||
103 | * {@inheritdoc} |
||
104 | * |
||
105 | * @return bool |
||
106 | */ |
||
107 | public function isAvailable() |
||
117 | |||
118 | /** |
||
119 | * {@inheritdoc} |
||
120 | * |
||
121 | * @return $this |
||
122 | */ |
||
123 | public function start($background = false) |
||
135 | |||
136 | /** |
||
137 | * {@inheritdoc} |
||
138 | * |
||
139 | * @return string |
||
140 | */ |
||
141 | public function getCommand() |
||
145 | |||
146 | /** |
||
147 | * {@inheritdoc} |
||
148 | * |
||
149 | * @param bool $loop |
||
150 | * @return array |
||
151 | */ |
||
152 | public function getStatus($loop = false) |
||
161 | |||
162 | /** |
||
163 | * {@inheritdoc} |
||
164 | * |
||
165 | * @return bool |
||
166 | */ |
||
167 | public function isRunning() |
||
172 | |||
173 | /** |
||
174 | * {@inheritdoc} |
||
175 | * |
||
176 | * @return string |
||
177 | */ |
||
178 | public function getError() |
||
182 | |||
183 | /** |
||
184 | * {@inheritdoc} |
||
185 | * |
||
186 | * @return int |
||
187 | */ |
||
188 | public function close() |
||
193 | |||
194 | /** |
||
195 | * Format a shell command according to the running Operating System to avoid zombie processes. |
||
196 | * |
||
197 | * @param string $command A shell command. |
||
198 | * @return string |
||
199 | */ |
||
200 | private function formatCommand($command) |
||
207 | |||
208 | /** |
||
209 | * Helper to create an array suitable as a descriptor for process streams. |
||
210 | * |
||
211 | * @return array |
||
212 | */ |
||
213 | private function getDescriptorSpec() |
||
221 | } |
||
222 |