src/Sasedev/ExtraToolsBundle/Util/UnitConverter/ChainUnitConverter.php
public function guessConvert($value, $destinationUnit, $locale = null)
	{
		$result = array();
		if (preg_match('#([\d,\.\s]+)\s*([^\s]+)#', $value, $result) > 0) {
			
			return $this->convert(\floatval(\str_replace(array(',', ' '), array('.', ''), $result[1])), $result[2], $destinationUnit, 
				$locale);
		}
		
		return null;
	}
public function guessConvert($value, $destinationUnit, $locale = null)
	{
		$result = array();
		if (preg_match('#([\d,\.\s]+)\s*([^\s]+)#', $value, $result) > 0) {
			
			return $this->convert(\floatval(\str_replace(array(',', ' '), array('.', ''), $result[1])), $result[2], $destinationUnit, 
				$locale);
		}
		
		return null;
	}
public function guessConvert ( $ value , $ destinationUnit , $ locale = null ) { $ result = array ( ) ; if ( preg_match ( '#([\d,\.\s]+)\s*([^\s]+)#' , $ value , $ result ) > 0 ) { return $ this -> convert ( \ floatval ( \ str_replace ( array ( ',' , ' ' ) , array ( '.' , '' ) , $ result [ 1 ] ) ) , $ result [ 2 ] , $ destinationUnit , $ locale ) ; } return null ; }
Tries to guess the source unit by parsing the string and then apply a convertion.
Returns null if fails or not supported.

@param string $value
@param string $destinationUnit
@param
string the locale (optional)
@return mixed The converted value
Tries to guess the source unit by parsing the string and then apply a convertion . Returns null if fails or not supported .