24 if ( !is_string( $version ) ) {
25 throw new InvalidArgumentException(
'$version must be a string' );
28 return preg_replace(
'/^(\d[\d\.]*)([a-zA-Z]+)(\d*)$/',
'$1-$2$3', $version, 1 );
47 if ( !is_string( $version ) ) {
48 throw new InvalidArgumentException(
'$version must be a string' );
51 $dashPosition = strpos( $version,
'-' );
53 if ( $dashPosition !==
false ) {
54 $suffix = substr( $version, $dashPosition );
55 $version = substr( $version, 0, $dashPosition );
58 $version = implode(
'.', array_pad( explode(
'.', $version ), 4,
'0' ) );
60 if ( $dashPosition !==
false ) {