| 1 | <?php |
||
| 11 | trait WindowTrait { |
||
| 12 | /** |
||
| 13 | * Returns the current page window name |
||
| 14 | * @return string |
||
| 15 | */ |
||
| 16 | public function getWindowName() { |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Return all the window handles currently present in phantomjs |
||
| 22 | * @return array |
||
| 23 | */ |
||
| 24 | public function getWindowNames() { |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Switches to window by name if possible |
||
| 30 | * @param $name |
||
| 31 | * @throws DriverException |
||
| 32 | */ |
||
| 33 | public function switchToWindow($name = null) { |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Resizing a window with specified size |
||
| 51 | * @param int $width |
||
| 52 | * @param int $height |
||
| 53 | * @param string $name |
||
| 54 | * @throws DriverException |
||
| 55 | */ |
||
| 56 | public function resizeWindow($width, $height, $name = null) { |
||
| 63 | |||
| 64 | } |
||
| 65 |
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: