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
*
@@ -19,7 +20,6 @@
namespace Combodo\iTop\Application\UI\Base\Layout\TabContainer\Tab;
use Combodo\iTop\Application\UI\Base\iUIBlock;
use Combodo\iTop\Application\UI\Base\UIException;
use Dict;
@@ -35,7 +35,6 @@ use utils;
*/
class AjaxTab extends Tab
{
/**
* @see static::$sPlaceholderRelPath
* @var string
@@ -92,7 +91,8 @@ class AjaxTab extends Tab
*
* @return $this
*/
public function SetUrl(string $sUrl) {
public function SetUrl(string $sUrl)
{
$this->sUrl = $sUrl;
return $this;
@@ -101,7 +101,8 @@ class AjaxTab extends Tab
/**
* @return string
*/
public function GetUrl(): string {
public function GetUrl(): string
{
return $this->sUrl;
}
@@ -112,7 +113,8 @@ class AjaxTab extends Tab
*
* @return $this
*/
public function SetCache(bool $bCache) {
public function SetCache(bool $bCache)
{
$this->bCache = $bCache;
return $this;
@@ -123,7 +125,8 @@ class AjaxTab extends Tab
*
* @return string
*/
public function GetCache(): string {
public function GetCache(): string
{
return $this->bCache ? 'true' : 'false';
}
@@ -133,7 +136,8 @@ class AjaxTab extends Tab
*
* @return $this
*/
public function SetPlaceholderRelPath(string $sPlaceholderRelPath) {
public function SetPlaceholderRelPath(string $sPlaceholderRelPath)
{
$this->sPlaceholderRelPath = $sPlaceholderRelPath;
return $this;
@@ -143,7 +147,8 @@ class AjaxTab extends Tab
*
* @return string
*/
public function GetPlaceholderRelPath(): string {
public function GetPlaceholderRelPath(): string
{
return $this->sPlaceholderRelPath;
}
@@ -152,7 +157,8 @@ class AjaxTab extends Tab
* @return string
* @throws \Exception
*/
public function GetPlaceholderAbsPath(): string {
public function GetPlaceholderAbsPath(): string
{
return utils::GetAbsoluteUrlAppRoot().$this->sPlaceholderRelPath;
}
@@ -163,7 +169,8 @@ class AjaxTab extends Tab
/**
* @inheritDoc
*/
public function GetParameters(): array {
public function GetParameters(): array
{
$aParams = parent::GetParameters();
$aParams['sURL'] = $this->GetUrl();
@@ -180,7 +187,8 @@ class AjaxTab extends Tab
* @inheritDoc
* @throws \Combodo\iTop\Application\UI\Base\UIException
*/
public function AddHtml(string $sHtml) {
public function AddHtml(string $sHtml)
{
throw new UIException($this, Dict::Format('UIBlock:Error:AddBlockForbidden', $this->GetId()));
}
@@ -188,14 +196,16 @@ class AjaxTab extends Tab
* @inheritDoc
* @throws \Combodo\iTop\Application\UI\Base\UIException
*/
public function AddSubBlock(?iUIBlock $oSubBlock) {
public function AddSubBlock(?iUIBlock $oSubBlock)
{
throw new UIException($this, Dict::Format('UIBlock:Error:AddBlockForbidden', $this->GetId()));
}
/**
* @inheritDoc
*/
public function GetSubBlocks(): array {
public function GetSubBlocks(): array
{
return [];
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -19,7 +20,6 @@
namespace Combodo\iTop\Application\UI\Base\Layout\TabContainer\Tab;
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
use Combodo\iTop\Application\WebPage\TabManager;
use utils;

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -19,7 +20,6 @@
namespace Combodo\iTop\Application\UI\Base\Layout\TabContainer;
use appUserPreferences;
use Combodo\iTop\Application\UI\Base\iUIBlock;
use Combodo\iTop\Application\UI\Base\Layout\iUIContentBlock;
@@ -45,7 +45,7 @@ class TabContainer extends UIContentBlock
'node_modules/scrollmagic/scrollmagic/minified/ScrollMagic.min.js',
'js/layouts/tab-container/tab-container.js',
'js/layouts/tab-container/regular-tabs.js',
'js/layouts/tab-container/scrollable-tabs.js'
'js/layouts/tab-container/scrollable-tabs.js',
];
// Specific constants
@@ -58,7 +58,6 @@ class TabContainer extends UIContentBlock
/** @var bool */
public const DEFAULT_SCROLLABLE = false;
/** @var string $sName */
private $sName;
/** @var string $sPrefix */
@@ -125,7 +124,7 @@ class TabContainer extends UIContentBlock
*/
public function AddAjaxTab(string $sTabCode, string $sTitle, ?string $sPlaceholder = null, ?string $sDescription = null): Tab
{
if($sPlaceholder === null){
if ($sPlaceholder === null) {
$sPlaceholder = AjaxTab::DEFAULT_TAB_PLACEHOLDER;
}
$oTab = new AjaxTab($sTabCode, $sTitle, $sPlaceholder);
@@ -184,7 +183,7 @@ class TabContainer extends UIContentBlock
return [
'sBlockId' => $this->GetId(),
'aTabs' => $aTabs
'aTabs' => $aTabs,
];
}
@@ -193,7 +192,8 @@ class TabContainer extends UIContentBlock
*
* @return $this
*/
public function SetLayout($sLayout) {
public function SetLayout($sLayout)
{
$this->sLayout = $sLayout;
return $this;
@@ -202,7 +202,8 @@ class TabContainer extends UIContentBlock
/**
* @return string
*/
public function GetLayout(): string {
public function GetLayout(): string
{
return $this->sLayout;
}
@@ -210,7 +211,8 @@ class TabContainer extends UIContentBlock
* @param bool $bIsScrollable
* @return $this
*/
public function SetIsScrollable($bIsScrollable) {
public function SetIsScrollable($bIsScrollable)
{
$this->bIsScrollable = $bIsScrollable;
return $this;
@@ -219,7 +221,8 @@ class TabContainer extends UIContentBlock
/**
* @return bool
*/
public function GetIsScrollable(): bool {
public function GetIsScrollable(): bool
{
return $this->bIsScrollable;
}
}