mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-27 12:38:44 +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
|
||||
*
|
||||
@@ -149,8 +150,15 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
bool $bIsSubmit = false,
|
||||
?string $sId = null
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_DESTRUCTIVE, Button::ENUM_ACTION_TYPE_REGULAR, $sValue, $sName,
|
||||
$bIsSubmit, $sId);
|
||||
return static::MakeForAction(
|
||||
$sLabel,
|
||||
Button::ENUM_COLOR_SCHEME_DESTRUCTIVE,
|
||||
Button::ENUM_ACTION_TYPE_REGULAR,
|
||||
$sValue,
|
||||
$sName,
|
||||
$bIsSubmit,
|
||||
$sId
|
||||
);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@@ -175,8 +183,15 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
bool $bIsSubmit = false,
|
||||
?string $sId = null
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_NEUTRAL, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
|
||||
$bIsSubmit, $sId);
|
||||
return static::MakeForAction(
|
||||
$sLabel,
|
||||
Button::ENUM_COLOR_SCHEME_NEUTRAL,
|
||||
Button::ENUM_ACTION_TYPE_ALTERNATIVE,
|
||||
$sValue,
|
||||
$sName,
|
||||
$bIsSubmit,
|
||||
$sId
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -198,8 +213,15 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
bool $bIsSubmit = false,
|
||||
?string $sId = null
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_PRIMARY, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
|
||||
$bIsSubmit, $sId);
|
||||
return static::MakeForAction(
|
||||
$sLabel,
|
||||
Button::ENUM_COLOR_SCHEME_PRIMARY,
|
||||
Button::ENUM_ACTION_TYPE_ALTERNATIVE,
|
||||
$sValue,
|
||||
$sName,
|
||||
$bIsSubmit,
|
||||
$sId
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -220,8 +242,15 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
bool $bIsSubmit = false,
|
||||
?string $sId = null
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_SECONDARY, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
|
||||
$bIsSubmit, $sId);
|
||||
return static::MakeForAction(
|
||||
$sLabel,
|
||||
Button::ENUM_COLOR_SCHEME_SECONDARY,
|
||||
Button::ENUM_ACTION_TYPE_ALTERNATIVE,
|
||||
$sValue,
|
||||
$sName,
|
||||
$bIsSubmit,
|
||||
$sId
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -242,8 +271,15 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
bool $bIsSubmit = false,
|
||||
?string $sId = null
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_VALIDATION, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
|
||||
$bIsSubmit, $sId);
|
||||
return static::MakeForAction(
|
||||
$sLabel,
|
||||
Button::ENUM_COLOR_SCHEME_VALIDATION,
|
||||
Button::ENUM_ACTION_TYPE_ALTERNATIVE,
|
||||
$sValue,
|
||||
$sName,
|
||||
$bIsSubmit,
|
||||
$sId
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -264,8 +300,15 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
bool $bIsSubmit = false,
|
||||
?string $sId = null
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_DESTRUCTIVE, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
|
||||
$bIsSubmit, $sId);
|
||||
return static::MakeForAction(
|
||||
$sLabel,
|
||||
Button::ENUM_COLOR_SCHEME_DESTRUCTIVE,
|
||||
Button::ENUM_ACTION_TYPE_ALTERNATIVE,
|
||||
$sValue,
|
||||
$sName,
|
||||
$bIsSubmit,
|
||||
$sId
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -289,8 +332,15 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
$sLabel = $sLabel ?? Dict::S('UI:Button:Cancel');
|
||||
$sName = $sName ?? 'cancel';
|
||||
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_NEUTRAL, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
|
||||
$bIsSubmit, $sId);
|
||||
return static::MakeForAction(
|
||||
$sLabel,
|
||||
Button::ENUM_COLOR_SCHEME_NEUTRAL,
|
||||
Button::ENUM_ACTION_TYPE_ALTERNATIVE,
|
||||
$sValue,
|
||||
$sName,
|
||||
$bIsSubmit,
|
||||
$sId
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -311,8 +361,15 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
bool $bIsSubmit = false,
|
||||
?string $sId = null
|
||||
) {
|
||||
$oButton = static::MakeForAction('', Button::ENUM_COLOR_SCHEME_NEUTRAL, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
|
||||
$bIsSubmit, $sId);
|
||||
$oButton = static::MakeForAction(
|
||||
'',
|
||||
Button::ENUM_COLOR_SCHEME_NEUTRAL,
|
||||
Button::ENUM_ACTION_TYPE_ALTERNATIVE,
|
||||
$sValue,
|
||||
$sName,
|
||||
$bIsSubmit,
|
||||
$sId
|
||||
);
|
||||
$oButton->SetIconClass($sIconClasses);
|
||||
$oButton->SetTooltip($sTooltipText);
|
||||
|
||||
@@ -335,14 +392,17 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Button\Button
|
||||
*/
|
||||
public static function MakeLinkNeutral(
|
||||
string $sURL, ?string $sLabel = '', ?string $sIconClasses = null, ?string $sTarget = null,
|
||||
string $sURL,
|
||||
?string $sLabel = '',
|
||||
?string $sIconClasses = null,
|
||||
?string $sTarget = null,
|
||||
?string $sId = null
|
||||
) {
|
||||
if (empty($sTarget)) {
|
||||
$sTarget = ButtonURL::DEFAULT_TARGET;
|
||||
}
|
||||
$sType = empty($sIconClasses) ? Button::ENUM_ACTION_TYPE_REGULAR : Button::ENUM_ACTION_TYPE_ALTERNATIVE;
|
||||
$oButton = static::MakeForLink($sLabel, $sURL,Button::ENUM_COLOR_SCHEME_NEUTRAL, $sType, $sTarget, $sId);
|
||||
$oButton = static::MakeForLink($sLabel, $sURL, Button::ENUM_COLOR_SCHEME_NEUTRAL, $sType, $sTarget, $sId);
|
||||
|
||||
if (!empty($sIconClasses)) {
|
||||
$oButton->SetIconClass($sIconClasses);
|
||||
@@ -361,19 +421,22 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Button\ButtonURL
|
||||
*/
|
||||
public static function MakeIconLink(
|
||||
string $sIconClasses, string $sTooltipText, ?string $sURL = '', ?string $sTarget = null,
|
||||
string $sIconClasses,
|
||||
string $sTooltipText,
|
||||
?string $sURL = '',
|
||||
?string $sTarget = null,
|
||||
?string $sId = null
|
||||
) {
|
||||
if (empty($sTarget)) {
|
||||
$sTarget = ButtonURL::DEFAULT_TARGET;
|
||||
}
|
||||
$oButton = static::MakeForLink('', $sURL,Button::ENUM_COLOR_SCHEME_NEUTRAL, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sTarget, $sId);
|
||||
$oButton = static::MakeForLink('', $sURL, Button::ENUM_COLOR_SCHEME_NEUTRAL, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sTarget, $sId);
|
||||
$oButton->SetIconClass($sIconClasses);
|
||||
$oButton->SetTooltip($sTooltipText);
|
||||
|
||||
return $oButton;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $sIconClasses
|
||||
* @param string $sTooltipText
|
||||
@@ -385,10 +448,14 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Button\Button
|
||||
*/
|
||||
public static function MakeDestructiveIconLink(
|
||||
string $sIconClasses, string $sTooltipText, ?string $sURL = null, ?string $sName = null, ?string $sTarget = null,
|
||||
string $sIconClasses,
|
||||
string $sTooltipText,
|
||||
?string $sURL = null,
|
||||
?string $sName = null,
|
||||
?string $sTarget = null,
|
||||
?string $sId = null
|
||||
) {
|
||||
$oButton = static::MakeIconLink($sIconClasses, $sTooltipText, $sURL, $sTarget, $sId);
|
||||
$oButton = static::MakeIconLink($sIconClasses, $sTooltipText, $sURL, $sTarget, $sId);
|
||||
$oButton->SetColor(Button::ENUM_COLOR_SCHEME_DESTRUCTIVE);
|
||||
$oButton->SetTooltip($sTooltipText);
|
||||
return $oButton;
|
||||
@@ -467,7 +534,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
$oButton = new ButtonURL($sLabel, $sURL, $sId, $sTarget);
|
||||
$oButton->SetActionType($sActionType)
|
||||
->SetColor($sColor);
|
||||
|
||||
|
||||
return $oButton;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user