1 | <?php |
||
11 | trait JavascriptTrait { |
||
12 | |||
13 | /** |
||
14 | * Executes a script on the browser |
||
15 | * @param string $script |
||
16 | */ |
||
17 | public function executeScript($script) { |
||
20 | |||
21 | /** |
||
22 | * Evaluates a script and returns the result |
||
23 | * @param string $script |
||
24 | * @return mixed |
||
25 | */ |
||
26 | public function evaluateScript($script) { |
||
29 | |||
30 | /** |
||
31 | * Waits some time or until JS condition turns true. |
||
32 | * |
||
33 | * @param integer $timeout timeout in milliseconds |
||
34 | * @param string $condition JS condition |
||
35 | * @return boolean |
||
36 | * @throws DriverException When the operation cannot be done |
||
37 | */ |
||
38 | public function wait($timeout, $condition) { |
||
48 | |||
49 | } |
||
50 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: