| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | public function switchToWindow($name = null) { |
||
| 34 | $handles = $this->browser->windowHandles(); |
||
| 35 | if ($name === null) { |
||
| 36 | //null means back to the main window |
||
| 37 | return $this->browser->switchToWindow($handles[0]); |
||
| 38 | } |
||
| 39 | |||
| 40 | $windowHandle = $this->browser->windowHandle($name); |
||
| 41 | if (!empty($windowHandle)) { |
||
| 42 | $this->browser->switchToWindow($windowHandle); |
||
| 43 | } else { |
||
| 44 | throw new DriverException("Could not find window handle by a given window name: $name"); |
||
| 45 | } |
||
| 46 | |||
| 47 | } |
||
| 48 | |||
| 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: