Skip to content

Commit b1efb70

Browse files
committed
"refactoring"
1 parent bb2d7ed commit b1efb70

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

lib/Authentication/Util/Cache.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class Cache
99
{
10-
private $file_cache = array();
10+
private static $file_cache = array();
1111

1212
public function __construct()
1313
{
@@ -16,7 +16,6 @@ public function __construct()
1616

1717
public function updateCache($filePath, $merchantConfig)
1818
{
19-
echo "update call";
2019
$fileName = basename($filePath);
2120
$fileModTime = filemtime($filePath);
2221
$keyPass = $merchantConfig->getKeyPassword();
@@ -38,7 +37,7 @@ public function updateCache($filePath, $merchantConfig)
3837
$mleCert = Utility::findCertByAlias($certs, $merchantConfig->getMleKeyAlias());
3938
}
4039

41-
$this->file_cache[$fileName] = [
40+
self::$file_cache[$fileName] = [
4241
'private_key' => $privateKey,
4342
'publicKey' => $publicKey,
4443
'file_mod_time' => $fileModTime,
@@ -53,10 +52,9 @@ public function grabFileFromP12($merchantConfig)
5352
$fileName = basename($filePath);
5453
$fileModTime = filemtime($filePath);
5554

56-
if (!isset($this->file_cache[$fileName]) || $this->file_cache[$fileName]['file_mod_time'] !== $fileModTime) {
55+
if (!isset(self::$file_cache[$fileName]) || self::$file_cache[$fileName]['file_mod_time'] !== $fileModTime) {
5756
$this->updateCache($filePath, $merchantConfig);
5857
}
59-
echo "just returning";
6058
return $this->file_cache[$fileName];
6159
}
6260

@@ -90,15 +88,15 @@ public function grabKeyFromPEM($filePath)
9088
$fileName = basename($filePath);
9189
$fileModTime = filemtime($filePath);
9290

93-
if (!isset($this->file_cache[$fileName]) || $this->file_cache[$fileName]['file_mod_time'] !== $fileModTime) {
91+
if (!isset(self::$file_cache[$fileName]) || self::$file_cache[$fileName]['file_mod_time'] !== $fileModTime) {
9492
$privateKeyFromPEMFile = self::loadKeyFromPEMFile($filePath);
95-
$this->file_cache[$fileName] = [
93+
self::$file_cache[$fileName] = [
9694
'private_key' => $privateKeyFromPEMFile,
9795
'file_mod_time' => $fileModTime,
9896
];
9997
}
10098

101-
return $this->file_cache[$fileName]['private_key'];
99+
return self::$file_cache[$fileName]['private_key'];
102100
}
103101

104102
private function PemToDer($Pem)

0 commit comments

Comments
 (0)