mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2026-03-30 08:20:09 +02:00
♻️ Refactor PhpEnvironments and Preferences
This commit is contained in:
@@ -143,14 +143,27 @@ class PhpEnvironments {
|
||||
|
||||
/**
|
||||
The version that the `php` formula via Brew is aliased to on the current system.
|
||||
|
||||
|
||||
If you're up to date, `php` will be aliased to the latest version,
|
||||
but that might not be the case since not everyone keeps their
|
||||
software up-to-date.
|
||||
|
||||
As such, we take that information from Homebrew.
|
||||
|
||||
In order for our check to be correct, we query Homebrew locally.
|
||||
*/
|
||||
static var brewPhpAlias: String?
|
||||
private static let _brewPhpAlias = Locked<String?>(nil)
|
||||
static var brewPhpAlias: String? {
|
||||
get { _brewPhpAlias.value }
|
||||
set { _brewPhpAlias.value = newValue }
|
||||
}
|
||||
|
||||
/**
|
||||
Information we were able to discern from the Homebrew info command.
|
||||
*/
|
||||
private let _homebrewPackage = Locked<HomebrewPackage?>(nil)
|
||||
var homebrewPackage: HomebrewPackage! {
|
||||
get { _homebrewPackage.value }
|
||||
set { _homebrewPackage.value = newValue }
|
||||
}
|
||||
|
||||
/**
|
||||
It's possible for the alias to be newer than the actual installed version of PHP.
|
||||
@@ -193,11 +206,6 @@ class PhpEnvironments {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Information we were able to discern from the Homebrew info command.
|
||||
*/
|
||||
var homebrewPackage: HomebrewPackage! = nil
|
||||
|
||||
// MARK: - Methods
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,18 +11,23 @@ import Foundation
|
||||
class Preferences {
|
||||
var container: Container
|
||||
|
||||
// MARK - Preferences
|
||||
|
||||
var customPreferences: CustomPrefs {
|
||||
get { _customPreferences.value }
|
||||
set { _customPreferences.value = newValue }
|
||||
}
|
||||
private let _customPreferences: Locked<CustomPrefs>
|
||||
|
||||
var cachedPreferences: [PreferenceName: Any?] {
|
||||
get { _cachedPreferences.value }
|
||||
set { _cachedPreferences.value = newValue }
|
||||
}
|
||||
|
||||
private let _customPreferences: Locked<CustomPrefs>
|
||||
private let _cachedPreferences: Locked<[PreferenceName: Any?]>
|
||||
|
||||
// MARK - Initialization
|
||||
|
||||
public init(container: Container) {
|
||||
self.container = container
|
||||
Preferences.handleFirstTimeLaunch()
|
||||
|
||||
Reference in New Issue
Block a user