| Conditions | 3 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 6 | ||
| Bugs | 4 | Features | 1 |
| 1 | <?php |
||
| 58 | public function replaceWith($html) |
||
| 59 | { |
||
| 60 | $frag = $this->getOwnerDocument()->createDocumentFragment(); |
||
| 61 | $frag->appendXml($html); |
||
| 62 | |||
| 63 | $newNode = $this->getParentNode()->insertBefore($frag, $this); |
||
| 64 | |||
| 65 | if (!empty($this->onReplace)) { |
||
| 66 | foreach ($this->onReplace as $onReplace) { |
||
| 67 | call_user_func($onReplace, $newNode, $this, $frag); |
||
| 68 | } |
||
| 69 | } |
||
| 70 | |||
| 71 | return $newNode; |
||
| 72 | } |
||
| 73 | } |
||
| 74 |
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: