/** * Copies all attributes from object into self. * * @param XML $from * @param bool $overwrite * @return XML */ public function copyAttributes($from, $overwrite = false) { foreach ($from->attributes() as $kk => $vv) { if ($overwrite || !isset($this[$kk])) { $this[$kk] = (string) $vv; } } return $this; }