mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
N°8796 - Add PHP code style validation in iTop and extensions - format whole code base
This commit is contained in:
@@ -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";
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user