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

🎨 Use Self to refer to current type

This commit is contained in:
2021-02-05 10:07:48 +01:00
parent 3d042b24ed
commit 9e8117d31f
2 changed files with 6 additions and 6 deletions

View File

@ -47,7 +47,7 @@ class PhpExtension {
When registering an extension, we do that based on the line found inside the .ini file. When registering an extension, we do that based on the line found inside the .ini file.
*/ */
init(_ line: String, file: String) { init(_ line: String, file: String) {
let regex = try! NSRegularExpression(pattern: PhpExtension.extensionRegex, options: []) let regex = try! NSRegularExpression(pattern: Self.extensionRegex, options: [])
let match = regex.matches(in: line, options: [], range: NSMakeRange(0, line.count)).first let match = regex.matches(in: line, options: [], range: NSMakeRange(0, line.count)).first
let range = Range(match!.range(withName: "name"), in: line)! let range = Range(match!.range(withName: "name"), in: line)!
@ -84,7 +84,7 @@ class PhpExtension {
return file!.components(separatedBy: "\n") return file!.components(separatedBy: "\n")
.filter({ (line) -> Bool in .filter({ (line) -> Bool in
return line.range(of: PhpExtension.extensionRegex, options: .regularExpression) != nil return line.range(of: Self.extensionRegex, options: .regularExpression) != nil
}) })
.map { (line) -> PhpExtension in .map { (line) -> PhpExtension in
return PhpExtension(line, file: path.path) return PhpExtension(line, file: path.path)

View File

@ -23,7 +23,7 @@ class PhpInstall {
init() { init() {
// Show information about the current version // Show information about the current version
self.version = type(of: self).getVersion() self.version = Self.getVersion()
// If an error occurred, exit early // If an error occurred, exit early
if (self.version.error) { if (self.version.error) {
@ -38,9 +38,9 @@ class PhpInstall {
// Get configuration values // Get configuration values
self.configuration = Configuration( self.configuration = Configuration(
memory_limit: type(of: self).getByteCount(key: "memory_limit"), memory_limit: Self.getByteCount(key: "memory_limit"),
upload_max_filesize: type(of: self).getByteCount(key: "upload_max_filesize"), upload_max_filesize: Self.getByteCount(key: "upload_max_filesize"),
post_max_size: type(of: self).getByteCount(key: "post_max_size") post_max_size: Self.getByteCount(key: "post_max_size")
) )
} }