1 | <?php |
||
19 | trait InputTrait |
||
20 | { |
||
21 | /** |
||
22 | * Cookies. |
||
23 | * |
||
24 | * @var array |
||
25 | */ |
||
26 | private $cookies = [ |
||
27 | 'add' => [], |
||
28 | 'remove' => [], |
||
29 | ]; |
||
30 | |||
31 | /** |
||
32 | * Settings. |
||
33 | * |
||
34 | * (default value: []) |
||
35 | * |
||
36 | * @var array |
||
37 | */ |
||
38 | private $settings = []; |
||
39 | |||
40 | /** |
||
41 | * Custom input settings. |
||
42 | * |
||
43 | * (default value: []) |
||
44 | * |
||
45 | * @var array |
||
46 | */ |
||
47 | private $custom = []; |
||
48 | |||
49 | /** |
||
50 | * Create new input with |
||
51 | * added custom setting. |
||
52 | * |
||
53 | * @param string $name |
||
54 | * @param mixed $value |
||
55 | * |
||
56 | * @return \JonnyW\PhantomJs\IO\InputInterface |
||
57 | */ |
||
58 | public function withCustom($name, $value) |
||
65 | |||
66 | /** |
||
67 | * Create new input with |
||
68 | * custom setting removed. |
||
69 | * |
||
70 | * @param string $name |
||
71 | * |
||
72 | * @return \JonnyW\PhantomJs\IO\InputInterface |
||
73 | */ |
||
74 | public function withoutCustom($name) |
||
82 | |||
83 | /** |
||
84 | * Get custom setting. |
||
85 | * |
||
86 | * @param string $name |
||
87 | * |
||
88 | * @return mixed |
||
89 | */ |
||
90 | public function getCustom($name) |
||
98 | |||
99 | /** |
||
100 | * Has cookie. |
||
101 | * |
||
102 | * @param string $cookie |
||
103 | * |
||
104 | * @return bool |
||
105 | */ |
||
106 | public function hasCookie($cookie) |
||
110 | |||
111 | /** |
||
112 | * Get single added cookie. |
||
113 | * |
||
114 | * @param string $cookie |
||
115 | * |
||
116 | * @return \JonnyW\PhantomJs\Page\Cookie|null |
||
117 | */ |
||
118 | public function getCookie($cookie) |
||
126 | |||
127 | /** |
||
128 | * Get all cookies. |
||
129 | * |
||
130 | * @return array |
||
131 | */ |
||
132 | public function getCookies() |
||
136 | |||
137 | /** |
||
138 | * Create new input with |
||
139 | * added cookie. |
||
140 | * |
||
141 | * @param \JonnyW\PhantomJs\Page\Cookie $cookie |
||
142 | * |
||
143 | * @return \JonnyW\PhantomJs\IO\InputInterface |
||
144 | */ |
||
145 | public function withCookie(Cookie $cookie) |
||
152 | |||
153 | /** |
||
154 | * Create new input with cookie |
||
155 | * removed and flagged for delete. |
||
156 | * |
||
157 | * @param string $cookie |
||
158 | * |
||
159 | * @return \JonnyW\PhantomJs\IO\InputInterface |
||
160 | */ |
||
161 | public function withoutCookie($cookie) |
||
170 | |||
171 | /** |
||
172 | * Has setting. |
||
173 | * |
||
174 | * @param string $setting |
||
175 | * |
||
176 | * @return bool |
||
177 | */ |
||
178 | public function hasSetting($setting) |
||
182 | |||
183 | /** |
||
184 | * Get single setting. |
||
185 | * |
||
186 | * @param string $setting |
||
187 | * |
||
188 | * @return mixed |
||
189 | */ |
||
190 | public function getSetting($setting) |
||
198 | |||
199 | /** |
||
200 | * Get all settings. |
||
201 | * |
||
202 | * @return array |
||
203 | */ |
||
204 | public function getSettings() |
||
208 | |||
209 | /** |
||
210 | * Create new input with |
||
211 | * added setting. |
||
212 | * |
||
213 | * @param string $setting |
||
214 | * @param mixed $value |
||
215 | * |
||
216 | * @return \JonnyW\PhantomJs\IO\InputInterface |
||
217 | */ |
||
218 | public function withSetting($setting, $value) |
||
225 | |||
226 | /** |
||
227 | * Create new input with setting |
||
228 | * removed. |
||
229 | * |
||
230 | * @param string $setting |
||
231 | * |
||
232 | * @return \JonnyW\PhantomJs\IO\InputInterface |
||
233 | */ |
||
234 | public function withoutSetting($setting) |
||
242 | } |
||
243 |