mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
N°8796 - Add PHP code style validation in iTop and extensions - format whole code base
This commit is contained in:
@@ -21,8 +21,7 @@ class DataModelDependantCache
|
||||
|
||||
public static function GetInstance(): DataModelDependantCache
|
||||
{
|
||||
if (!isset(self::$oInstance))
|
||||
{
|
||||
if (!isset(self::$oInstance)) {
|
||||
self::$oInstance = new DataModelDependantCache();
|
||||
}
|
||||
return self::$oInstance;
|
||||
@@ -46,7 +45,7 @@ class DataModelDependantCache
|
||||
*/
|
||||
public function Store(string $sPool, string $sKey, mixed $value, array $aMoreInfo = []): void
|
||||
{
|
||||
if(is_null($value)) {
|
||||
if (is_null($value)) {
|
||||
// NULL cannot be stored as it collides with Fetch() returning NULL when the key does not exist
|
||||
throw new Exception('Cannot store NULL in the cache');
|
||||
}
|
||||
@@ -72,7 +71,9 @@ class DataModelDependantCache
|
||||
public function Fetch(string $sPool, string $sKey): mixed
|
||||
{
|
||||
$sCacheFileName = $this->MakeCacheFileName($sPool, $sKey);
|
||||
if (!is_file($sCacheFileName)) return null;
|
||||
if (!is_file($sCacheFileName)) {
|
||||
return null;
|
||||
}
|
||||
return include $sCacheFileName;
|
||||
}
|
||||
|
||||
@@ -98,7 +99,9 @@ class DataModelDependantCache
|
||||
public function GetEntryModificationTime(string $sPool, string $sKey): int|null
|
||||
{
|
||||
$sCacheFileName = $this->MakeCacheFileName($sPool, $sKey);
|
||||
if (!is_file($sCacheFileName)) return null;
|
||||
if (!is_file($sCacheFileName)) {
|
||||
return null;
|
||||
}
|
||||
return filemtime($sCacheFileName);
|
||||
}
|
||||
/**
|
||||
@@ -146,7 +149,6 @@ class DataModelDependantCache
|
||||
return $this->GetStorageRootDir()."/$sPool/";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* for test purpose
|
||||
*
|
||||
@@ -167,4 +169,4 @@ class DataModelDependantCache
|
||||
{
|
||||
$this->sStorageRootDir = $sStorageRootDir;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user