1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-11-07 05:10:06 +01:00

♻️ Rework various common classes

This commit is contained in:
2021-12-21 16:00:27 +01:00
parent a6387e96e7
commit ceb168c6cf
21 changed files with 272 additions and 216 deletions

View File

@@ -0,0 +1,30 @@
//
// PhpInstallation.swift
// PHP Monitor
//
// Created by Nico Verbruggen on 28/11/2021.
// Copyright © 2021 Nico Verbruggen. All rights reserved.
//
import Foundation
class PhpInstallation {
var longVersion: String
/**
In order to determine details about a PHP installation, well simply run `php-config --version`
in the relevant directory.
*/
init(_ version: String) {
let phpConfigExecutablePath = "\(Paths.optPath)/php@\(version)/bin/php-config"
self.longVersion = version
if Shell.fileExists(phpConfigExecutablePath) {
self.longVersion = Command.execute(
path: phpConfigExecutablePath,
arguments: ["--version"]
)
}
}
}