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.
*/
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 range = Range(match!.range(withName: "name"), in: line)!
@ -84,7 +84,7 @@ class PhpExtension {
return file!.components(separatedBy: "\n")
.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
return PhpExtension(line, file: path.path)

View File

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