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,9 +1,10 @@
<?php
// Copyright (C) 2010-2024 Combodo SAS
//
// This file is part of iTop.
//
// iTop is free software; you can redistribute it and/or modify
// iTop is free software; you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
@@ -22,33 +23,32 @@ use DBSearch;
use ExecutionKPI;
/**
* CLI page
* CLI page
* The page adds the content-type text/XML and the encoding into the headers
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
class CLIPage implements Page
{
/** @var string */
public $s_title;
function __construct($s_title)
{
$this->s_title = $s_title;
}
public function __construct($s_title)
{
$this->s_title = $s_title;
}
public function output()
{
if (class_exists('DBSearch')) {
DBSearch::RecordQueryTrace();
}
if (class_exists('ExecutionKPI')) {
ExecutionKPI::ReportStats();
}
}
public function output()
{
if (class_exists('DBSearch')) {
DBSearch::RecordQueryTrace();
}
if (class_exists('ExecutionKPI')) {
ExecutionKPI::ReportStats();
}
}
public function add($sText)
{
@@ -70,27 +70,21 @@ class CLIPage implements Page
echo "#".$sText."\n";
}
public function table($aConfig, $aData, $aParams = array())
public function table($aConfig, $aData, $aParams = [])
{
$aCells = array();
foreach($aConfig as $sName=>$aDef)
{
if (strlen($aDef['description']) > 0)
{
$aCells = [];
foreach ($aConfig as $sName => $aDef) {
if (strlen($aDef['description']) > 0) {
$aCells[] = $aDef['label'].' ('.$aDef['description'].')';
}
else
{
} else {
$aCells[] = $aDef['label'];
}
}
echo implode(';', $aCells)."\n";
foreach($aData as $aRow)
{
$aCells = array();
foreach($aConfig as $sName=>$aAttribs)
{
foreach ($aData as $aRow) {
$aCells = [];
foreach ($aConfig as $sName => $aAttribs) {
$sValue = $aRow["$sName"];
$aCells[] = $sValue;
}