Return version number as string instead of floats so '1.20' does not become 1.2

This commit is contained in:
Martin Hipp 2019-03-25 16:02:27 +13:00 committed by Guy Marriott
parent 9c2da06178
commit bff5eb2b79
No known key found for this signature in database
GPG Key ID: A80F9ACCB86D3DA7
1 changed files with 4 additions and 4 deletions

View File

@ -70,22 +70,22 @@ class TikaRestClient extends Client
/**
* Get version code
*
* @return float
* @return string
*/
public function getVersion()
{
/** @var Response $response */
$response = $this->get('version', $this->getGuzzleOptions());
$version = 0.0;
$version = 0;
// Parse output
if ($response->getStatusCode() == 200
&& preg_match('/Apache Tika (?<version>[\.\d]+)/', $response->getBody(), $matches)
) {
$version = (float)$matches['version'];
$version = $matches['version'];
}
return $version;
return (string) $version;
}
/**