1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-07 03:50:08 +02:00

♻️ Cleanup

This commit is contained in:
2022-12-06 19:28:20 +01:00
parent 3f8739dc30
commit 81183acea8
3 changed files with 49 additions and 53 deletions

View File

@ -25,35 +25,3 @@ protocol DomainListable {
func getListableUrl() -> URL?
}
extension ValetSite {
func getListableName() -> String {
return self.name
}
func getListableSecured() -> Bool {
return self.secured
}
func getListableAbsolutePath() -> String {
return self.absolutePath
}
func getListablePhpVersion() -> String {
return self.servingPhpVersion
}
func getListableKind() -> String {
return (self.aliasPath == nil) ? "linked" : "parked"
}
func getListableType() -> String {
return self.driver ?? "ZZZ"
}
func getListableUrl() -> URL? {
return URL(string: "\(self.secured ? "https://" : "http://")\(self.name).\(Valet.shared.config.tld)")
}
}

View File

@ -19,23 +19,3 @@ protocol DomainInteractable {
func unlink() async throws
}
extension ValetSite: DomainInteractable {
func secure() async throws {
try await ValetInteractor.secure(site: self)
}
func unsecure() async throws {
try await ValetInteractor.unsecure(site: self)
}
func isolate(version: PhpVersionNumber) async throws {
try await ValetInteractor.isolate(site: self, version: version)
}
func unlink() async throws {
try await ValetInteractor.unlink(site: self)
}
}

View File

@ -8,7 +8,7 @@
import Foundation
class ValetSite: DomainListable {
class ValetSite: DomainListable, DomainInteractable {
/// Name of the site. Does not include the TLD.
var name: String
@ -232,4 +232,52 @@ class ValetSite: DomainListable {
return nil
}
// MARK: DomainListable
func getListableName() -> String {
return self.name
}
func getListableSecured() -> Bool {
return self.secured
}
func getListableAbsolutePath() -> String {
return self.absolutePath
}
func getListablePhpVersion() -> String {
return self.servingPhpVersion
}
func getListableKind() -> String {
return (self.aliasPath == nil) ? "linked" : "parked"
}
func getListableType() -> String {
return self.driver ?? "ZZZ"
}
func getListableUrl() -> URL? {
return URL(string: "\(self.secured ? "https://" : "http://")\(self.name).\(Valet.shared.config.tld)")
}
// MARK: DomainInteractable
func secure() async throws {
try await ValetInteractor.secure(site: self)
}
func unsecure() async throws {
try await ValetInteractor.unsecure(site: self)
}
func isolate(version: PhpVersionNumber) async throws {
try await ValetInteractor.isolate(site: self, version: version)
}
func unlink() async throws {
try await ValetInteractor.unlink(site: self)
}
}