src/MadeYourDay/SVG/Document.php
protected function getPathPart(SimpleXMLElement $xmlElement, $onlyFilled){

		$path = '';

		if($xmlElement === null){
			$xmlElement = $this->xmlDocument;
		}

		foreach($xmlElement->children() as $child){
			$childName = $child->getName();
			if(!empty($child['transform'])){
				throw new \Exception('Transforms are currently not supported!');
			}
			if($childName === 'g'){
				$path .= ' '.$this->getPathPart($child, $onlyFilled);
			}
			else{
				if($onlyFilled && (string)$child['fill'] === 'none'){
					continue;
				}
				if($childName === 'polygon'){
					$path .= ' '.$this->getPathFromPolygon($child);
				}
				elseif($childName === 'rect'){
					$path .= ' '.$this->getPathFromRect($child);
				}
				elseif($childName === 'circle'){
					$path .= ' '.$this->getPathFromCircle($child);
				}
				elseif($childName === 'ellipse'){
					$path .= ' '.$this->getPathFromEllipse($child);
				}
				elseif($childName === 'path'){
					$pathPart = trim($child['d']);
					if(substr($pathPart, 0, 1) === 'm'){
						$pathPart = 'M'.substr($pathPart, 1);
					}
					$path .= ' '.$pathPart;
				}
			}
		}

		return trim($path);

	}
protected function getPathPart(SimpleXMLElement $xmlElement, $onlyFilled){

		$path = '';

		if($xmlElement === null){
			$xmlElement = $this->xmlDocument;
		}

		foreach($xmlElement->children() as $child){
			$childName = $child->getName();
			if(!empty($child['transform'])){
				throw new \Exception('Transforms are currently not supported!');
			}
			if($childName === 'g'){
				$path .= ' '.$this->getPathPart($child, $onlyFilled);
			}
			else{
				if($onlyFilled && (string)$child['fill'] === 'none'){
					continue;
				}
				if($childName === 'polygon'){
					$path .= ' '.$this->getPathFromPolygon($child);
				}
				elseif($childName === 'rect'){
					$path .= ' '.$this->getPathFromRect($child);
				}
				elseif($childName === 'circle'){
					$path .= ' '.$this->getPathFromCircle($child);
				}
				elseif($childName === 'ellipse'){
					$path .= ' '.$this->getPathFromEllipse($child);
				}
				elseif($childName === 'path'){
					$pathPart = trim($child['d']);
					if(substr($pathPart, 0, 1) === 'm'){
						$pathPart = 'M'.substr($pathPart, 1);
					}
					$path .= ' '.$pathPart;
				}
			}
		}

		return trim($path);

	}
protected function getPathPart ( SimpleXMLElement $ xmlElement , $ onlyFilled ) { $ path = '' ; if ( $ xmlElement === null ) { $ xmlElement = $ this -> xmlDocument ; } foreach ( $ xmlElement -> children ( ) as $ child ) { $ childName = $ child -> getName ( ) ; if ( ! empty ( $ child [ 'transform' ] ) ) { throw new \ Exception ( 'Transforms are currently not supported!' ) ; } if ( $ childName === 'g' ) { $ path .= ' ' . $ this -> getPathPart ( $ child , $ onlyFilled ) ; } else { if ( $ onlyFilled && ( string ) $ child [ 'fill' ] === 'none' ) { continue ; } if ( $ childName === 'polygon' ) { $ path .= ' ' . $ this -> getPathFromPolygon ( $ child ) ; } elseif ( $ childName === 'rect' ) { $ path .= ' ' . $ this -> getPathFromRect ( $ child ) ; } elseif ( $ childName === 'circle' ) { $ path .= ' ' . $ this -> getPathFromCircle ( $ child ) ; } elseif ( $ childName === 'ellipse' ) { $ path .= ' ' . $ this -> getPathFromEllipse ( $ child ) ; } elseif ( $ childName === 'path' ) { $ pathPart = trim ( $ child [ 'd' ] ) ; if ( substr ( $ pathPart , 0 , 1 ) === 'm' ) { $ pathPart = 'M' . substr ( $ pathPart , 1 ) ; } $ path .= ' ' . $ pathPart ; } } } return trim ( $ path ) ; }
returns one single SVG path definition for all elements in the specified element

@param  SimpleXMLElement $xmlElement group or svg element
@param  boolean          $onlyFilled ignore non filled objects
@return string                       SVG path definition
returns one single SVG path definition for all elements in the specified element