1 | <?php |
||
23 | class Client implements ClientInterface |
||
24 | { |
||
25 | /** |
||
26 | * Client. |
||
27 | * |
||
28 | * @var \JonnyW\PhantomJs\ClientInterface |
||
29 | * @access private |
||
30 | */ |
||
31 | private static $instance; |
||
32 | |||
33 | /** |
||
34 | * PhantomJs engine. |
||
35 | * |
||
36 | * @var \JonnyW\PhantomJs\Engine |
||
37 | * @access protected |
||
38 | */ |
||
39 | protected $engine; |
||
40 | |||
41 | /** |
||
42 | * Procedure loader. |
||
43 | * |
||
44 | * @var \JonnyW\PhantomJs\Procedure\ProcedureLoaderInterface |
||
45 | * @access protected |
||
46 | */ |
||
47 | protected $procedureLoader; |
||
48 | |||
49 | /** |
||
50 | * Procedure validator. |
||
51 | * |
||
52 | * @var \JonnyW\PhantomJs\Procedure\ProcedureCompilerInterface |
||
53 | * @access protected |
||
54 | */ |
||
55 | protected $procedureCompiler; |
||
56 | |||
57 | /** |
||
58 | * Message factory. |
||
59 | * |
||
60 | * @var \JonnyW\PhantomJs\Http\MessageFactoryInterface |
||
61 | * @access protected |
||
62 | */ |
||
63 | protected $messageFactory; |
||
64 | |||
65 | /** |
||
66 | * Procedure template |
||
67 | * |
||
68 | * @var string |
||
69 | * @access protected |
||
70 | */ |
||
71 | protected $procedure; |
||
72 | |||
73 | /** |
||
74 | * Internal constructor |
||
75 | * |
||
76 | * @access public |
||
77 | * @param \JonnyW\PhantomJs\Engine $engine |
||
78 | * @param \JonnyW\PhantomJs\Procedure\ProcedureLoaderInterface $procedureLoader |
||
79 | * @param \JonnyW\PhantomJs\Procedure\ProcedureCompilerInterface $procedureCompiler |
||
80 | * @param \JonnyW\PhantomJs\Http\MessageFactoryInterface $messageFactory |
||
81 | * @return void |
||
|
|||
82 | */ |
||
83 | 36 | public function __construct(Engine $engine, ProcedureLoaderInterface $procedureLoader, ProcedureCompilerInterface $procedureCompiler, MessageFactoryInterface $messageFactory) |
|
91 | |||
92 | /** |
||
93 | * Get singleton instance |
||
94 | * |
||
95 | * @access public |
||
96 | * @return \JonnyW\PhantomJs\Client |
||
97 | */ |
||
98 | 6 | public static function getInstance() |
|
114 | |||
115 | /** |
||
116 | * Get PhantomJs engine. |
||
117 | * |
||
118 | * @access public |
||
119 | * @return \JonnyW\PhantomJs\Engine |
||
120 | */ |
||
121 | 10 | public function getEngine() |
|
125 | |||
126 | /** |
||
127 | * Get message factory instance |
||
128 | * |
||
129 | * @access public |
||
130 | * @return \JonnyW\PhantomJs\Http\MessageFactoryInterface |
||
131 | */ |
||
132 | 33 | public function getMessageFactory() |
|
136 | |||
137 | /** |
||
138 | * Get procedure loader instance |
||
139 | * |
||
140 | * @access public |
||
141 | * @return \JonnyW\PhantomJs\Procedure\ProcedureLoaderInterface |
||
142 | */ |
||
143 | 9 | public function getProcedureLoader() |
|
147 | |||
148 | /** |
||
149 | * Send request |
||
150 | * |
||
151 | * @access public |
||
152 | * @param \JonnyW\PhantomJs\Http\RequestInterface $request |
||
153 | * @param \JonnyW\PhantomJs\Http\ResponseInterface $response |
||
154 | * @return \JonnyW\PhantomJs\Http\ResponseInterface |
||
155 | */ |
||
156 | 32 | public function send(RequestInterface $request, ResponseInterface $response) |
|
166 | |||
167 | /** |
||
168 | * Get log. |
||
169 | * |
||
170 | * @access public |
||
171 | * @return string |
||
172 | */ |
||
173 | 9 | public function getLog() |
|
177 | |||
178 | /** |
||
179 | * Set procedure template. |
||
180 | * |
||
181 | * @access public |
||
182 | * @param string $procedure |
||
183 | * @return void |
||
184 | */ |
||
185 | 3 | public function setProcedure($procedure) |
|
189 | |||
190 | /** |
||
191 | * Get procedure template. |
||
192 | * |
||
193 | * @access public |
||
194 | * @return string |
||
195 | */ |
||
196 | public function getProcedure() |
||
200 | |||
201 | /** |
||
202 | * Get procedure compiler. |
||
203 | * |
||
204 | * @access public |
||
205 | * @return \JonnyW\PhantomJs\Procedure\ProcedureCompilerInterface |
||
206 | */ |
||
207 | public function getProcedureCompiler() |
||
211 | |||
212 | /** |
||
213 | * Set lazy request flag. |
||
214 | * |
||
215 | * @access public |
||
216 | * @return void |
||
217 | */ |
||
218 | 2 | public function isLazy() |
|
222 | } |
||
223 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.