From 195d5e4609ccf250c5e209351d85d9b7271abc2b Mon Sep 17 00:00:00 2001 From: Jay Trees Date: Mon, 17 Jan 2022 13:22:47 +0100 Subject: [PATCH] Refactor --- includes/classes/options.php | 5 +++++ index.php | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/includes/classes/options.php b/includes/classes/options.php index 3a20cafe..50fe634b 100644 --- a/includes/classes/options.php +++ b/includes/classes/options.php @@ -14,8 +14,13 @@ class Options { public bool $updateAvailable = false; + public string $version; + public function __construct(private Database $database) { + $this->version = $this->getOption('version') + ? $this->getOption('version') + : '0.1.0'; } public function getOption(string $key): string diff --git a/index.php b/index.php index 1a2ff928..a3136d96 100644 --- a/index.php +++ b/index.php @@ -73,9 +73,7 @@ if (!$options) { * Update */ if ($options) { - $version_current = $options->getOption('version') ?? '0.0.0'; - - if (-1 === version_compare($version_current, $version_new)) { + if (-1 === version_compare($options->version, $version_new)) { $options->updateAvailable = true; } }