src/SVGCreator/Element.php
public function getString() {
			// Validate the element first of all!
			$this->validateElement();

			// Start writing the tag
			$elementStringData = '';
			$elementStringData = '<' . static::TYPE;
			foreach ( $this->attributes as $key => $data ) {
				$elementStringData .= ' ' . $key . '="' . $data . '"';
			}
			// Close the initiating tag
			$elementStringData .= '>';

			if ( $this->text !== null ) {
				$elementStringData .= $this->text;
			}

			// If it has child elements we have to write them!
			if ( count($this->childElements) > 0 ) {

				// See if there are definitions to put if the type is svg this is run here
				// because the definition area should be the first to appear!
				if  ( static::TYPE == 'svg' ) {
					foreach ( $this->childElements as $childElement ) {
						// Let's get the definitions array from the child element and propagate them to the top!
						$this->defs = array_merge($this->defs, $childElement->getDefs());
					}

					// If there are definitions to add then add them
					if ( count($this->defs) > 0 ) {
						// Create the defs area
						$defArea = new \SVGCreator\Elements\Defs();
						foreach ( $this->defs as $def ) {
							// Append all elements to def area
							$defArea->append($def);
						}
						// Get the defarea xml
						$elementStringData .= $defArea->getString();
					}
				}

				// Iterate trough each element and write it's child element
				foreach ( $this->childElements as $childElement ) {
					$elementStringData .= $childElement->getString();
				}
			}
			// Always close the tag with no self closing, simplifys things a bit
			// and it's not a couple of bytes that has us worried
			$elementStringData .= '</' . static::TYPE . '>';

			$this->elementString = $elementStringData;

			return $this->elementString;
		}
public function getString() {
			// Validate the element first of all!
			$this->validateElement();

			// Start writing the tag
			$elementStringData = '';
			$elementStringData = '<' . static::TYPE;
			foreach ( $this->attributes as $key => $data ) {
				$elementStringData .= ' ' . $key . '="' . $data . '"';
			}
			// Close the initiating tag
			$elementStringData .= '>';

			if ( $this->text !== null ) {
				$elementStringData .= $this->text;
			}

			// If it has child elements we have to write them!
			if ( count($this->childElements) > 0 ) {

				// See if there are definitions to put if the type is svg this is run here
				// because the definition area should be the first to appear!
				if  ( static::TYPE == 'svg' ) {
					foreach ( $this->childElements as $childElement ) {
						// Let's get the definitions array from the child element and propagate them to the top!
						$this->defs = array_merge($this->defs, $childElement->getDefs());
					}

					// If there are definitions to add then add them
					if ( count($this->defs) > 0 ) {
						// Create the defs area
						$defArea = new \SVGCreator\Elements\Defs();
						foreach ( $this->defs as $def ) {
							// Append all elements to def area
							$defArea->append($def);
						}
						// Get the defarea xml
						$elementStringData .= $defArea->getString();
					}
				}

				// Iterate trough each element and write it's child element
				foreach ( $this->childElements as $childElement ) {
					$elementStringData .= $childElement->getString();
				}
			}
			// Always close the tag with no self closing, simplifys things a bit
			// and it's not a couple of bytes that has us worried
			$elementStringData .= '</' . static::TYPE . '>';

			$this->elementString = $elementStringData;

			return $this->elementString;
		}
Returns the element string

@return string  				Returns the element string