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

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -27,59 +28,46 @@ require_once(APPROOT.'/application/startup.inc.php');
// this file is generated dynamically with location = here
$sWsdlUri = utils::GetAbsoluteUrlAppRoot().'webservices/itop.wsdl.php';
$sServiceCategory = utils::ReadParam('service_category');
if (!empty($sServiceCategory))
{
if (!empty($sServiceCategory)) {
$sWsdlUri .= "?service_category=".$sServiceCategory;
}
ini_set("soap.wsdl_cache_enabled","0");
ini_set("soap.wsdl_cache_enabled", "0");
$aSOAPMapping = SOAPMapping::GetMapping();
$oSoapServer = new SoapServer
(
$oSoapServer = new SoapServer(
$sWsdlUri,
array(
'classmap' => $aSOAPMapping
)
[
'classmap' => $aSOAPMapping,
]
);
// $oSoapServer->setPersistence(SOAP_PERSISTENCE_SESSION);
if (!empty($sServiceCategory))
{
if (!empty($sServiceCategory)) {
$sServiceClass = $sServiceCategory;
if (!class_exists($sServiceClass))
{
if (!class_exists($sServiceClass)) {
// not a valid class name (not a PHP class at all)
throw new SoapFault("iTop SOAP server", "Invalid argument service_category: '$sServiceClass' is not a PHP class");
}
elseif (!is_subclass_of($sServiceClass, 'WebServicesBase'))
{
} elseif (!is_subclass_of($sServiceClass, 'WebServicesBase')) {
// not a valid class name (not deriving from WebServicesBase)
throw new SoapFault("iTop SOAP server", "Invalid argument service_category: '$sServiceClass' is not derived from WebServicesBase");
}
else
{
} else {
$oSoapServer->setClass($sServiceClass, null);
}
}
else
{
} else {
$oSoapServer->setClass('BasicServices', null);
}
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
if ($_SERVER["REQUEST_METHOD"] == "POST") {
CMDBObject::SetTrackOrigin('webservice-soap');
$oSoapServer->handle();
}
else
{
} else {
echo "This SOAP server can handle the following functions: ";
$aFunctions = $oSoapServer->getFunctions();
echo "<ul>\n";
foreach($aFunctions as $sFunc)
{
if ($sFunc == 'GetWSDLContents') continue;
foreach ($aFunctions as $sFunc) {
if ($sFunc == 'GetWSDLContents') {
continue;
}
echo "<li>$sFunc</li>\n";
}
@@ -88,10 +76,8 @@ else
echo "You may also want to try the following service categories: ";
echo "<ul>\n";
foreach(get_declared_classes() as $sPHPClass)
{
if (is_subclass_of($sPHPClass, 'WebServicesBase'))
{
foreach (get_declared_classes() as $sPHPClass) {
if (is_subclass_of($sPHPClass, 'WebServicesBase')) {
$sServiceCategory = $sPHPClass;
$sSoapServerUri = utils::GetAbsoluteUrlAppRoot().'webservices/soapserver.php';
$sSoapServerUri .= "?service_category=$sServiceCategory";
@@ -100,4 +86,3 @@ else
}
echo "</ul>\n";
}
?>