public static function extract(string
$versionString): array
{ if (stripos($versionString, 'mariadb'
) === false
) { $versionStringDashPosition =
strpos($versionString, '-'
);
if ($versionStringDashPosition !== false
) { $versionString =
substr($versionString, 0,
$versionStringDashPosition);
} return ['mysql',
$versionString];
} return ['mariadb', self::
getVersionNumber($versionString)];
} private static function getVersionNumber(string
$versionString): string
{ if (!
preg_match( '/^(?:5\.5\.5-)?(mariadb-)?(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)/i',
$versionString,
$versionParts )) { throw new RuntimeException(sprintf('Invalid version string: %s',
$versionString));
}