| Conditions | 3 |
| Paths | 4 |
| Total Lines | 11 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function setCookie($name, $value = null) { |
||
| 19 | if ($value === null) { |
||
| 20 | $this->browser->removeCookie($name); |
||
|
|
|||
| 21 | } |
||
| 22 | //TODO: set the cookie with domain, not with url, meaning www.aaa.com or .aaa.com |
||
| 23 | if ($value !== null) { |
||
| 24 | $urlData = parse_url($this->getCurrentUrl()); |
||
| 25 | $cookie = array("name" => $name, "value" => $value, "domain" => $urlData["host"]); |
||
| 26 | $this->browser->setCookie($cookie); |
||
| 27 | } |
||
| 28 | } |
||
| 29 | |||
| 46 |
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: