N°8796 - Add PHP code style validation in iTop and extensions - format whole code base

This commit is contained in:
odain
2025-11-07 15:39:53 +01:00
parent 12f23113f5
commit 890a2568c8
2110 changed files with 53099 additions and 63885 deletions

View File

@@ -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;
}
}
}