From 2694df19732044cc67f8434933eacbd6dcbff515 Mon Sep 17 00:00:00 2001 From: Steffen Lange Date: Fri, 1 May 2020 15:10:56 +0200 Subject: [PATCH] Tidy up GitHub release tags --- PatchBase.php | 2 +- PatchObject.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/PatchBase.php b/PatchBase.php index d2f1975..0f56b5b 100644 --- a/PatchBase.php +++ b/PatchBase.php @@ -42,7 +42,7 @@ abstract class PatchBase { protected function parse_json(string $key) : bool { $flat = iterator_to_array(new \RecursiveIteratorIterator(new \RecursiveArrayIterator($this->data))); if (!empty($flat[$key])) { - $this->patch->setVersion(ltrim($flat[$key], 'v')); + $this->patch->setVersion($flat[$key], true); return true; } return false; diff --git a/PatchObject.php b/PatchObject.php index 74f0a46..4742626 100644 --- a/PatchObject.php +++ b/PatchObject.php @@ -38,7 +38,10 @@ class PatchObject { function getVersion() : string { return $this->version; } - function setVersion(string $version) { + function setVersion(string $version, bool $trim = false) { + if ($trim) { + $version = preg_replace('/^(release-|v)/', '', $version); + } $this->version = $version; } function getURL() : string {