mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-22 08:42:17 +02:00
code style only
This commit is contained in:
@@ -2748,9 +2748,11 @@ class Config
|
|||||||
fwrite($hFile, "\t'$sModule' => array (\n");
|
fwrite($hFile, "\t'$sModule' => array (\n");
|
||||||
foreach ($aProperties as $sProperty => $value) {
|
foreach ($aProperties as $sProperty => $value) {
|
||||||
if (is_string($value) && false !== strpos($value, 'PhpParserComment')) {
|
if (is_string($value) && false !== strpos($value, 'PhpParserComment')) {
|
||||||
$value = preg_replace(["/.*StartPhpParserComment/", "/EndPhpParserComment/"],
|
$value = preg_replace(
|
||||||
|
["/.*StartPhpParserComment/", "/EndPhpParserComment/"],
|
||||||
['', ''],
|
['', ''],
|
||||||
$value);
|
$value
|
||||||
|
);
|
||||||
fwrite($hFile, "\t\t$value\n");
|
fwrite($hFile, "\t\t$value\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -2941,9 +2943,11 @@ class Config
|
|||||||
|
|
||||||
$sExport = var_export($value, true);
|
$sExport = var_export($value, true);
|
||||||
if (strpos($sExport, 'PhpParserComment')) {
|
if (strpos($sExport, 'PhpParserComment')) {
|
||||||
$sExport = preg_replace(["/.*StartPhpParserComment/", "/EndPhpParserComment',/"],
|
$sExport = preg_replace(
|
||||||
|
["/.*StartPhpParserComment/", "/EndPhpParserComment',/"],
|
||||||
['', ''],
|
['', ''],
|
||||||
$sExport);
|
$sExport
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$sNiceExport = str_replace(["\r\n", "\n", "\r"], "\n".$sIndentation, trim($sExport));
|
$sNiceExport = str_replace(["\r\n", "\n", "\r"], "\n".$sIndentation, trim($sExport));
|
||||||
if (!$bForceIndentation) {
|
if (!$bForceIndentation) {
|
||||||
|
|||||||
@@ -61,10 +61,10 @@ PHP;
|
|||||||
public function GetArrayWithComments(Array_ $oArray): array
|
public function GetArrayWithComments(Array_ $oArray): array
|
||||||
{
|
{
|
||||||
$aRes = [];
|
$aRes = [];
|
||||||
$i=0;
|
$i = 0;
|
||||||
foreach ($oArray->items as $oItem) {
|
foreach ($oArray->items as $oItem) {
|
||||||
/** @var \PhpParser\Node\ArrayItem $oItem **/
|
/** @var \PhpParser\Node\ArrayItem $oItem **/
|
||||||
if(is_null($oItem->key)){
|
if (is_null($oItem->key)) {
|
||||||
$sKey = $i;
|
$sKey = $i;
|
||||||
$i++;
|
$i++;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -103,8 +103,9 @@ class ConfigTest extends ItopTestCase
|
|||||||
$this->assertEquals($this->GetModuleSettingSection($sConfigFile), $this->GetModuleSettingSection($sTmpFile));
|
$this->assertEquals($this->GetModuleSettingSection($sConfigFile), $this->GetModuleSettingSection($sTmpFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function GetModuleSettingSection(string $sFilePath) : string {
|
private function GetModuleSettingSection(string $sFilePath): string
|
||||||
|
{
|
||||||
preg_match('/\$MyModuleSettings[\w\W]*\/\*\*/m', file_get_contents($sFilePath), $aMatches);
|
preg_match('/\$MyModuleSettings[\w\W]*\/\*\*/m', file_get_contents($sFilePath), $aMatches);
|
||||||
return preg_replace(['/[ ]+/', '/[ ]+/'],[' ', ' '], $aMatches[0]);
|
return preg_replace(['/[ ]+/', '/[ ]+/'], [' ', ' '], $aMatches[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user