protected function transformPath($path, $scale, $roundPrecision, $flip, $xOffset, $yOffset){

		if($flip === 'horizontal' || $flip === 'vertical'){
			$viewBox = $this->getViewBox();
		}

		return preg_replace_callback('([m,l,h,v,c,s,q,t,a,z](?:[\\s,]*-?(?=\\.?\\d)\\d*(?:\\.\\d+)?)*)i', function($maches) use ($scale, $roundPrecision, $flip, $xOffset, $yOffset, $viewBox){

			$command = substr($maches[0], 0, 1);
			$absoluteCommand = strtoupper($command) === $command;
			$xyCommand = in_array(strtolower($command), array('m','l','c','s','q','t'));
			$xCommand = strtolower($command) === 'h';
			$yCommand = strtolower($command) === 'v';
			if(strtolower($command) === 'z'){
				return $command;
			}
			if(strtolower($command) === 'a'){
				throw new \Exception('Path command "A" is currently not supportet!');
			}
			$values = $this->getValuesFromList(substr($maches[0], 1));

			foreach($values as $key => $value) {

				if(
					$flip === 'horizontal' &&
					((!($key%2) && $xyCommand) || $xCommand)
				){
					$values[$key] *= -1;
					if($absoluteCommand){
						$values[$key] += $viewBox['width'];
					}
				}
				if(
					$flip === 'vertical' &&
					(($key%2 && $xyCommand) || $yCommand)
				){
					$values[$key] *= -1;
					if($absoluteCommand){
						$values[$key] += $viewBox['height'];
					}
				}
				if(
					$absoluteCommand &&
					((!($key%2) && $xyCommand) || $xCommand)
				){
					$values[$key] += $xOffset;
				}
				if(
					$absoluteCommand &&
					(($key%2 && $xyCommand) || $yCommand)
				){
					$values[$key] += $yOffset;
				}
				$values[$key] *= $scale;
				if($roundPrecision !== null){
					$values[$key] = round($values[$key], $roundPrecision);
				}

			}

			return $command.implode(' ', $values);

		}, $path);

	}
protected function transformPath($path, $scale, $roundPrecision, $flip, $xOffset, $yOffset){

		if($flip === 'horizontal' || $flip === 'vertical'){
			$viewBox = $this->getViewBox();
		}

		return preg_replace_callback('([m,l,h,v,c,s,q,t,a,z](?:[\\s,]*-?(?=\\.?\\d)\\d*(?:\\.\\d+)?)*)i', function($maches) use ($scale, $roundPrecision, $flip, $xOffset, $yOffset, $viewBox){

			$command = substr($maches[0], 0, 1);
			$absoluteCommand = strtoupper($command) === $command;
			$xyCommand = in_array(strtolower($command), array('m','l','c','s','q','t'));
			$xCommand = strtolower($command) === 'h';
			$yCommand = strtolower($command) === 'v';
			if(strtolower($command) === 'z'){
				return $command;
			}
			if(strtolower($command) === 'a'){
				throw new \Exception('Path command "A" is currently not supportet!');
			}
			$values = $this->getValuesFromList(substr($maches[0], 1));

			foreach($values as $key => $value) {

				if(
					$flip === 'horizontal' &&
					((!($key%2) && $xyCommand) || $xCommand)
				){
					$values[$key] *= -1;
					if($absoluteCommand){
						$values[$key] += $viewBox['width'];
					}
				}
				if(
					$flip === 'vertical' &&
					(($key%2 && $xyCommand) || $yCommand)
				){
					$values[$key] *= -1;
					if($absoluteCommand){
						$values[$key] += $viewBox['height'];
					}
				}
				if(
					$absoluteCommand &&
					((!($key%2) && $xyCommand) || $xCommand)
				){
					$values[$key] += $xOffset;
				}
				if(
					$absoluteCommand &&
					(($key%2 && $xyCommand) || $yCommand)
				){
					$values[$key] += $yOffset;
				}
				$values[$key] *= $scale;
				if($roundPrecision !== null){
					$values[$key] = round($values[$key], $roundPrecision);
				}

			}

			return $command.implode(' ', $values);

		}, $path);

	}
protected function transformPath ( $ path , $ scale , $ roundPrecision , $ flip , $ xOffset , $ yOffset ) { if ( $ flip === 'horizontal' || $ flip === 'vertical' ) { $ viewBox = $ this -> getViewBox ( ) ; } return preg_replace_callback ( '([m,l,h,v,c,s,q,t,a,z](?:[\\s,]*-?(?=\\.?\\d)\\d*(?:\\.\\d+)?)*)i' , function ( $ maches ) use ( $ scale , $ roundPrecision , $ flip , $ xOffset , $ yOffset , $ viewBox ) { $ command = substr ( $ maches [ 0 ] , 0 , 1 ) ; $ absoluteCommand = strtoupper ( $ command ) === $ command ; $ xyCommand = in_array ( strtolower ( $ command ) , array ( 'm' , 'l' , 'c' , 's' , 'q' , 't' ) ) ; $ xCommand = strtolower ( $ command ) === 'h' ; $ yCommand = strtolower ( $ command ) === 'v' ; if ( strtolower ( $ command ) === 'z' ) { return $ command ; } if ( strtolower ( $ command ) === 'a' ) { throw new \ Exception ( 'Path command "A" is currently not supportet!' ) ; } $ values = $ this -> getValuesFromList ( substr ( $ maches [ 0 ] , 1 ) ) ; foreach ( $ values as $ key => $ value ) { if ( $ flip === 'horizontal' && ( ( ! ( $ key % 2 ) && $ xyCommand ) || $ xCommand ) ) { $ values [ $ key ] *= - 1 ; if ( $ absoluteCommand ) { $ values [ $ key ] += $ viewBox [ 'width' ] ; } } if ( $ flip === 'vertical' && ( ( $ key % 2 && $ xyCommand ) || $ yCommand ) ) { $ values [ $ key ] *= - 1 ; if ( $ absoluteCommand ) { $ values [ $ key ] += $ viewBox [ 'height' ] ; } } if ( $ absoluteCommand && ( ( ! ( $ key % 2 ) && $ xyCommand ) || $ xCommand ) ) { $ values [ $ key ] += $ xOffset ; } if ( $ absoluteCommand && ( ( $ key % 2 && $ xyCommand ) || $ yCommand ) ) { $ values [ $ key ] += $ yOffset ; } $ values [ $ key ] *= $ scale ; if ( $ roundPrecision !== null ) { $ values [ $ key ] = round ( $ values [ $ key ] , $ roundPrecision ) ; } } return $ command . implode ( ' ' , $ values ) ; } , $ path ) ; }
transforms a SVG path definition by the given parameters

@param  string  $path           SVG path definition
@param  float   $scale          a positive number how much the path should be scaled (1 means 100%)
@param  integer $roundPrecision number of decimal digits to round to or null to disable rounding
@param  string  $flip           'none', 'horizontal' or 'vertical' (requires a valid view box)
@param  integer $xOffset        x offset
@param  integer $yOffset        y offset
@return string                  SVG path definition
transforms a SVG path definition by the given parameters