protected function setAttributes(DOMNode $from, DOMNode $to, array $options) {
		$width = isset($options['width']) ? (int)$options['width'] : 0;
		$height = isset($options['height']) ? (int)$options['height'] : 0;
		$class = isset($options['class']) ? (string)$options['class'] : '';

		$classes = explode(' ', $class . ' ' . $from->getAttribute('class'));
		$classes = array_map('trim', $classes);
		$classes = array_filter($classes);
		$classes = array_unique($classes);
		$to->setAttribute('class', implode(' ', $classes));

		if ($width || $from->hasAttribute('width')) {
			$to->setAttribute('width', $width ?: $from->getAttribute('width'));
		}
		if ($height || $from->hasAttribute('height')) {
			$to->setAttribute('height', $height ?: $from->getAttribute('height'));
		}
		if ($from->hasAttribute('viewBox')) {
			$to->setAttribute('viewBox', $from->getAttribute('viewBox'));
		}
		if ($from->hasAttribute('preserveAspectRatio')) {
			$to->setAttribute('preserveAspectRatio', $from->getAttribute('preserveAspectRatio'));
		}
	}
protected function setAttributes(DOMNode $from, DOMNode $to, array $options) {
		$width = isset($options['width']) ? (int)$options['width'] : 0;
		$height = isset($options['height']) ? (int)$options['height'] : 0;
		$class = isset($options['class']) ? (string)$options['class'] : '';

		$classes = explode(' ', $class . ' ' . $from->getAttribute('class'));
		$classes = array_map('trim', $classes);
		$classes = array_filter($classes);
		$classes = array_unique($classes);
		$to->setAttribute('class', implode(' ', $classes));

		if ($width || $from->hasAttribute('width')) {
			$to->setAttribute('width', $width ?: $from->getAttribute('width'));
		}
		if ($height || $from->hasAttribute('height')) {
			$to->setAttribute('height', $height ?: $from->getAttribute('height'));
		}
		if ($from->hasAttribute('viewBox')) {
			$to->setAttribute('viewBox', $from->getAttribute('viewBox'));
		}
		if ($from->hasAttribute('preserveAspectRatio')) {
			$to->setAttribute('preserveAspectRatio', $from->getAttribute('preserveAspectRatio'));
		}
	}
protected function setAttributes ( DOMNode $ from , DOMNode $ to , array $ options ) { $ width = isset ( $ options [ 'width' ] ) ? ( int ) $ options [ 'width' ] : 0 ; $ height = isset ( $ options [ 'height' ] ) ? ( int ) $ options [ 'height' ] : 0 ; $ class = isset ( $ options [ 'class' ] ) ? ( string ) $ options [ 'class' ] : '' ; $ classes = explode ( ' ' , $ class . ' ' . $ from -> getAttribute ( 'class' ) ) ; $ classes = array_map ( 'trim' , $ classes ) ; $ classes = array_filter ( $ classes ) ; $ classes = array_unique ( $ classes ) ; $ to -> setAttribute ( 'class' , implode ( ' ' , $ classes ) ) ; if ( $ width || $ from -> hasAttribute ( 'width' ) ) { $ to -> setAttribute ( 'width' , $ width ? : $ from -> getAttribute ( 'width' ) ) ; } if ( $ height || $ from -> hasAttribute ( 'height' ) ) { $ to -> setAttribute ( 'height' , $ height ? : $ from -> getAttribute ( 'height' ) ) ; } if ( $ from -> hasAttribute ( 'viewBox' ) ) { $ to -> setAttribute ( 'viewBox' , $ from -> getAttribute ( 'viewBox' ) ) ; } if ( $ from -> hasAttribute ( 'preserveAspectRatio' ) ) { $ to -> setAttribute ( 'preserveAspectRatio' , $ from -> getAttribute ( 'preserveAspectRatio' ) ) ; } }
copy or set attributes from one SVG onto another
copy or set attributes from one SVG onto another