diff --git a/core/config.class.inc.php b/core/config.class.inc.php index c1b3062f4..bebe6c832 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -1250,7 +1250,7 @@ class Config ), ); /** - * @var \Combodo\iTop\Config\Parser\iTopConfigParser|null + * @var \iTopConfigParser|null */ private $oItopConfigParser; diff --git a/core/iTopConfigParser.php b/core/iTopConfigParser.php index 74702a6c0..b074532e3 100644 --- a/core/iTopConfigParser.php +++ b/core/iTopConfigParser.php @@ -37,7 +37,7 @@ class iTopConfigParser { $oParser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7); - $this->browseFile($oParser, $sConfig); + $this->BrowseFile($oParser, $sConfig); } /** @@ -73,7 +73,7 @@ class iTopConfigParser * * @return \Combodo\iTop\Config\Validator\ConfigNodesVisitor */ - private function browseFile(\PhpParser\Parser $oParser, $sConfig) + private function BrowseFile(\PhpParser\Parser $oParser, $sConfig) { $prettyPrinter = new Standard(); diff --git a/datamodels/2.x/itop-config/config.php b/datamodels/2.x/itop-config/config.php index 44d30cccd..c42aaec54 100644 --- a/datamodels/2.x/itop-config/config.php +++ b/datamodels/2.x/itop-config/config.php @@ -43,11 +43,11 @@ function TestConfig($sContents, $oP) { /// 1- first check if there is no malicious code $oiTopConfigValidator = new iTopConfigAstValidator(); - $oiTopConfigValidator->validate($sContents); + $oiTopConfigValidator->Validate($sContents); /// 2 - only after we are sure that there is no malicious cade, we can perform a syntax check! $oiTopConfigValidator = new iTopConfigSyntaxValidator(); - $oiTopConfigValidator->validate($sContents, true); + $oiTopConfigValidator->Validate($sContents, true); } /** diff --git a/datamodels/2.x/itop-config/src/Validator/iTopConfigAstValidator.php b/datamodels/2.x/itop-config/src/Validator/iTopConfigAstValidator.php index cba632fb0..ffcfff8fc 100644 --- a/datamodels/2.x/itop-config/src/Validator/iTopConfigAstValidator.php +++ b/datamodels/2.x/itop-config/src/Validator/iTopConfigAstValidator.php @@ -21,7 +21,7 @@ class iTopConfigAstValidator * * @throws \Exception */ - public function validate($sConfig) + public function Validate($sConfig) { $oParser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7); diff --git a/datamodels/2.x/itop-config/src/Validator/iTopConfigSyntaxValidator.php b/datamodels/2.x/itop-config/src/Validator/iTopConfigSyntaxValidator.php index e7492e6c1..37ec18c03 100644 --- a/datamodels/2.x/itop-config/src/Validator/iTopConfigSyntaxValidator.php +++ b/datamodels/2.x/itop-config/src/Validator/iTopConfigSyntaxValidator.php @@ -7,12 +7,6 @@ namespace Combodo\iTop\Config\Validator; - -use PhpParser\NodeTraverser; -use PhpParser\NodeVisitor; -use PhpParser\Parser; -use PhpParser\ParserFactory; - class iTopConfigSyntaxValidator { /** @@ -21,7 +15,7 @@ class iTopConfigSyntaxValidator * @param $sConfig * @param $bAllowUnsecure */ - public function validate($sConfig, $bAllowUnsecure) + public function Validate($sConfig, $bAllowUnsecure) { exec('php -v', $aOutput, $iReturnVar); $bCanRunCli = ($iReturnVar == 0); diff --git a/test/itop-config/Validator/iTopConfigAstValidatorTest.php b/test/itop-config/Validator/iTopConfigAstValidatorTest.php index 68306294a..e06f7e0b6 100644 --- a/test/itop-config/Validator/iTopConfigAstValidatorTest.php +++ b/test/itop-config/Validator/iTopConfigAstValidatorTest.php @@ -35,7 +35,7 @@ class iTopConfigAstValidatorTest extends ItopTestCase $oiTopConfigValidator = new iTopConfigAstValidator(); $this->expectException(\Exception::class); try{ - $oiTopConfigValidator->validate($sConf); + $oiTopConfigValidator->Validate($sConf); }catch (\Exception $e) { $this->assertStringStartsWith('Invalid configuration:', $e->getMessage()); @@ -81,7 +81,7 @@ class iTopConfigAstValidatorTest extends ItopTestCase { $oiTopConfigValidator = new iTopConfigAstValidator(); - $oiTopConfigValidator->validate($sConf); + $oiTopConfigValidator->Validate($sConf); } public function ValidDataProvider() diff --git a/test/itop-config/Validator/iTopConfigSyntaxValidatorTest.php b/test/itop-config/Validator/iTopConfigSyntaxValidatorTest.php index f21c16977..d31029b24 100644 --- a/test/itop-config/Validator/iTopConfigSyntaxValidatorTest.php +++ b/test/itop-config/Validator/iTopConfigSyntaxValidatorTest.php @@ -32,7 +32,7 @@ class iTopConfigAstValidatorTest extends ItopTestCase public function testValidCode() { $oiTopConfigValidator = new iTopConfigSyntaxValidator(); - $oiTopConfigValidator->validate("Validate("expectException(\Exception::class); try{ - $oiTopConfigValidator->validate("", false); + $oiTopConfigValidator->Validate("", false); }catch (\Exception $e) { $this->assertStringStartsWith('PHP Parse error: syntax error, unexpected \'zdadz\' (T_STRING)', $e->getMessage());