/** * @param null|string $sibling * * @return Element|Tag|Field */ public function before($sibling = null) { $prev = $this->previousSibling; if (is_null($sibling)) { if ($prev) { return $prev; } return $this; } return $this->parent()->insertBefore($this->ownerDocument->importNode($this->ownerDocument->check($sibling)), $this); }
/** * @param $element * * @return Element|Field|Tag */ public function before($element) { return $this->parent()->insertBefore($this->ownerDocument->importNode($this->ownerDocument->check($element)), $this); }