mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
Introduce type hinting in methods prototype (PHP >= 7.1)
This commit is contained in:
@@ -52,9 +52,10 @@ class BlockRenderer
|
||||
* @throws \Twig\Error\RuntimeError
|
||||
* @throws \Twig\Error\SyntaxError
|
||||
*/
|
||||
public static function RenderBlockTemplates(iUIBlock $oBlock, $aContextParams = [])
|
||||
public static function RenderBlockTemplates(iUIBlock $oBlock, array $aContextParams = [])
|
||||
{
|
||||
$oSelf = new static($oBlock, $aContextParams);
|
||||
|
||||
return $oSelf->RenderTemplates();
|
||||
}
|
||||
|
||||
@@ -71,9 +72,9 @@ class BlockRenderer
|
||||
* @param \Combodo\iTop\Application\UI\iUIBlock $oBlock
|
||||
* @param array $aContextParams
|
||||
*/
|
||||
public function __construct(iUIBlock $oBlock, $aContextParams = [])
|
||||
public function __construct(iUIBlock $oBlock, array $aContextParams = [])
|
||||
{
|
||||
if(null === static::$oTwigEnv)
|
||||
if (null === static::$oTwigEnv)
|
||||
{
|
||||
static::$oTwigEnv = TwigHelper::GetTwigEnvironment(static::TWIG_BASE_PATH, static::TWIG_ADDITIONAL_PATHS);
|
||||
}
|
||||
|
||||
@@ -106,19 +106,20 @@ class RenderingOutput
|
||||
*/
|
||||
public function GetCssClasses()
|
||||
{
|
||||
return $this->aCssClasses;
|
||||
return $this->aCssClasses;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $sHtml
|
||||
* @param bool $bEncodeHtmlEntities
|
||||
*
|
||||
* @return \Combodo\iTop\Renderer\RenderingOutput
|
||||
*/
|
||||
public function AddHtml($sHtml, $bEncodeHtmlEntities = false)
|
||||
/**
|
||||
*
|
||||
* @param string $sHtml
|
||||
* @param bool $bEncodeHtmlEntities
|
||||
*
|
||||
* @return \Combodo\iTop\Renderer\RenderingOutput
|
||||
*/
|
||||
public function AddHtml(string $sHtml, bool $bEncodeHtmlEntities = false)
|
||||
{
|
||||
$this->sHtml .= ($bEncodeHtmlEntities) ? htmlentities($sHtml, ENT_QUOTES, 'UTF-8') : $sHtml;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -131,9 +132,10 @@ class RenderingOutput
|
||||
* @return $this
|
||||
* @since 2.7.0
|
||||
*/
|
||||
public function AddMetadata($sName, $sValue)
|
||||
public function AddMetadata(string $sName, string $sValue)
|
||||
{
|
||||
$this->aMetadata[$sName] = $sValue;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -145,23 +147,26 @@ class RenderingOutput
|
||||
* @return $this
|
||||
* @since 2.7.0
|
||||
*/
|
||||
public function RemoveMetadata($sName)
|
||||
public function RemoveMetadata(string $sName)
|
||||
{
|
||||
if (in_array($sName, $this->aMetadata))
|
||||
{
|
||||
unset($this->aJsFiles[$sName]);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $sJs
|
||||
*
|
||||
* @return \Combodo\iTop\Renderer\RenderingOutput
|
||||
*/
|
||||
public function AddJs($sJs)
|
||||
public function AddJs(string $sJs)
|
||||
{
|
||||
$this->sJsInline .= $sJs . "\n";
|
||||
$this->sJsInline .= $sJs."\n";
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -173,48 +178,55 @@ class RenderingOutput
|
||||
* @return $this
|
||||
* @since 2.8.0
|
||||
*/
|
||||
public function SetJsFiles($aFiles)
|
||||
public function SetJsFiles(array $aFiles)
|
||||
{
|
||||
$this->aJsFiles = $aFiles;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $sFile
|
||||
*
|
||||
* @return \Combodo\iTop\Renderer\RenderingOutput
|
||||
*/
|
||||
public function AddJsFile($sFile)
|
||||
public function AddJsFile(string $sFile)
|
||||
{
|
||||
if (!in_array($sFile, $this->aJsFiles))
|
||||
{
|
||||
$this->aJsFiles[] = $sFile;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $sFile
|
||||
*
|
||||
* @return \Combodo\iTop\Renderer\RenderingOutput
|
||||
*/
|
||||
public function RemoveJsFile($sFile)
|
||||
public function RemoveJsFile(string $sFile)
|
||||
{
|
||||
if (in_array($sFile, $this->aJsFiles))
|
||||
{
|
||||
unset($this->aJsFiles[$sFile]);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $sCss
|
||||
*
|
||||
* @return \Combodo\iTop\Renderer\RenderingOutput
|
||||
*/
|
||||
public function AddCss($sCss)
|
||||
public function AddCss(string $sCss)
|
||||
{
|
||||
$this->sCssInline .= $sCss . "\n";
|
||||
$this->sCssInline .= $sCss."\n";
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -226,24 +238,27 @@ class RenderingOutput
|
||||
* @return $this
|
||||
* @since 2.8.0
|
||||
*/
|
||||
public function SetCssFiles($aFiles)
|
||||
public function SetCssFiles(array $aFiles)
|
||||
{
|
||||
$this->aCssFiles = $aFiles;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $sFile
|
||||
* @return \Combodo\iTop\Renderer\RenderingOutput
|
||||
*/
|
||||
public function AddCssFile($sFile)
|
||||
{
|
||||
if (!in_array($sFile, $this->aCssFiles))
|
||||
{
|
||||
$this->aCssFiles[] = $sFile;
|
||||
}
|
||||
return $this;
|
||||
/**
|
||||
*
|
||||
* @param string $sFile
|
||||
*
|
||||
* @return \Combodo\iTop\Renderer\RenderingOutput
|
||||
*/
|
||||
public function AddCssFile(string $sFile)
|
||||
{
|
||||
if (!in_array($sFile, $this->aCssFiles))
|
||||
{
|
||||
$this->aCssFiles[] = $sFile;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -251,13 +266,14 @@ class RenderingOutput
|
||||
* @param string $sFile
|
||||
* @return \Combodo\iTop\Renderer\RenderingOutput
|
||||
*/
|
||||
public function RemoveCssFile($sFile)
|
||||
{
|
||||
if (in_array($sFile, $this->aCssFiles))
|
||||
{
|
||||
unset($this->aCssFiles[$sFile]);
|
||||
}
|
||||
return $this;
|
||||
public function RemoveCssFile(string $sFile)
|
||||
{
|
||||
if (in_array($sFile, $this->aCssFiles))
|
||||
{
|
||||
unset($this->aCssFiles[$sFile]);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -265,13 +281,14 @@ class RenderingOutput
|
||||
* @param string $sClass
|
||||
* @return \Combodo\iTop\Renderer\RenderingOutput
|
||||
*/
|
||||
public function AddCssClass($sClass)
|
||||
{
|
||||
if (!in_array($sClass, $this->aCssClasses))
|
||||
{
|
||||
$this->aCssClasses[] = $sClass;
|
||||
}
|
||||
return $this;
|
||||
public function AddCssClass(string $sClass)
|
||||
{
|
||||
if (!in_array($sClass, $this->aCssClasses))
|
||||
{
|
||||
$this->aCssClasses[] = $sClass;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -279,13 +296,14 @@ class RenderingOutput
|
||||
* @param string $sClass
|
||||
* @return \Combodo\iTop\Renderer\RenderingOutput
|
||||
*/
|
||||
public function RemoveCssClass($sClass)
|
||||
{
|
||||
if (in_array($sClass, $this->aCssClasses))
|
||||
{
|
||||
unset($this->aCssClasses[$sClass]);
|
||||
}
|
||||
return $this;
|
||||
public function RemoveCssClass(string $sClass)
|
||||
{
|
||||
if (in_array($sClass, $this->aCssClasses))
|
||||
{
|
||||
unset($this->aCssClasses[$sClass]);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ class Alert extends UIBlock
|
||||
* @param string $sColor
|
||||
* @param string|null $sId
|
||||
*/
|
||||
public function __construct($sTitle = '', $sContent = '', $sColor = self::DEFAULT_COLOR, $sId = null)
|
||||
public function __construct(string $sTitle = '', string $sContent = '', string $sColor = self::DEFAULT_COLOR, ?string $sId = null)
|
||||
{
|
||||
$this->sTitle = $sTitle;
|
||||
$this->sContent = $sContent;
|
||||
@@ -108,9 +108,10 @@ class Alert extends UIBlock
|
||||
|
||||
/**
|
||||
* @param string $sTitle
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetTitle($sTitle)
|
||||
public function SetTitle(string $sTitle)
|
||||
{
|
||||
$this->sTitle = $sTitle;
|
||||
|
||||
@@ -134,7 +135,7 @@ class Alert extends UIBlock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetContent($sContent)
|
||||
public function SetContent(string $sContent)
|
||||
{
|
||||
$this->sContent = $sContent;
|
||||
|
||||
@@ -153,9 +154,10 @@ class Alert extends UIBlock
|
||||
* @param string $sColor
|
||||
* @return $this
|
||||
*/
|
||||
public function SetColor($sColor)
|
||||
public function SetColor(string $sColor)
|
||||
{
|
||||
$this->sColor = $sColor;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ class AlertFactory
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Component\Alert\Alert
|
||||
*/
|
||||
public static function MakeNeutral($sTitle, $sContent)
|
||||
public static function MakeNeutral(string $sTitle, string $sContent)
|
||||
{
|
||||
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_NEUTRAL);
|
||||
}
|
||||
@@ -50,7 +50,7 @@ class AlertFactory
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Component\Alert\Alert
|
||||
*/
|
||||
public static function MakeForInformation($sTitle, $sContent)
|
||||
public static function MakeForInformation(string $sTitle, string $sContent)
|
||||
{
|
||||
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_INFORMATION);
|
||||
}
|
||||
@@ -63,7 +63,7 @@ class AlertFactory
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Component\Alert\Alert
|
||||
*/
|
||||
public static function MakeForSuccess($sTitle, $sContent)
|
||||
public static function MakeForSuccess(string $sTitle, string $sContent)
|
||||
{
|
||||
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_SUCCESS);
|
||||
}
|
||||
@@ -76,7 +76,7 @@ class AlertFactory
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Component\Alert\Alert
|
||||
*/
|
||||
public static function MakeForWarning($sTitle, $sContent)
|
||||
public static function MakeForWarning(string $sTitle, string $sContent)
|
||||
{
|
||||
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_WARNING);
|
||||
}
|
||||
@@ -89,7 +89,7 @@ class AlertFactory
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Component\Alert\Alert
|
||||
*/
|
||||
public static function MakeForDanger($sTitle, $sContent)
|
||||
public static function MakeForDanger(string $sTitle, string $sContent)
|
||||
{
|
||||
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_DANGER);
|
||||
}
|
||||
@@ -102,7 +102,7 @@ class AlertFactory
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Component\Alert\Alert
|
||||
*/
|
||||
public static function MakeForFailure($sTitle, $sContent)
|
||||
public static function MakeForFailure(string $sTitle, string $sContent)
|
||||
{
|
||||
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_FAILURE);
|
||||
}
|
||||
@@ -115,7 +115,7 @@ class AlertFactory
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Component\Alert\Alert
|
||||
*/
|
||||
public static function MakeWithBrandingPrimaryColor($sTitle, $sContent)
|
||||
public static function MakeWithBrandingPrimaryColor(string $sTitle, string $sContent)
|
||||
{
|
||||
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_PRIMARY);
|
||||
}
|
||||
@@ -128,7 +128,7 @@ class AlertFactory
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Component\Alert\Alert
|
||||
*/
|
||||
public static function MakeWithBrandingSecondaryColor($sTitle, $sContent)
|
||||
public static function MakeWithBrandingSecondaryColor(string $sTitle, string $sContent)
|
||||
{
|
||||
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_SECONDARY);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ class Breadcrumbs extends UIBlock
|
||||
* @param array|null $aNewEntry
|
||||
* @param string|null $sId
|
||||
*/
|
||||
public function __construct($aNewEntry = null, $sId = null)
|
||||
public function __construct(?array $aNewEntry = null, ?string $sId = null)
|
||||
{
|
||||
parent::__construct($sId);
|
||||
$this->SetNewEntry($aNewEntry);
|
||||
@@ -64,9 +64,10 @@ class Breadcrumbs extends UIBlock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetNewEntry($aNewEntry)
|
||||
public function SetNewEntry(array $aNewEntry)
|
||||
{
|
||||
$this->aNewEntry = $aNewEntry;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,8 +109,10 @@ class Button extends UIBlock
|
||||
* @param string $sOnClickJsCode
|
||||
*/
|
||||
public function __construct(
|
||||
$sLabel, $sId = null, $sName = '', $sValue = '', $sType = self::DEFAULT_TYPE, string $sTooltip = '', $sIconClass = '',
|
||||
$sActionType = self::DEFAULT_ACTION_TYPE, $sColor = self::DEFAULT_COLOR, $sJsCode = '', $sOnClickJsCode = ''
|
||||
string $sLabel, string $sId = null, string $sName = '', string $sValue = '', string $sType = self::DEFAULT_TYPE,
|
||||
string $sTooltip = '', string $sIconClass = '',
|
||||
string $sActionType = self::DEFAULT_ACTION_TYPE, string $sColor = self::DEFAULT_COLOR, string $sJsCode = '',
|
||||
string $sOnClickJsCode = ''
|
||||
) {
|
||||
$this->sLabel = $sLabel;
|
||||
$this->sName = $sName;
|
||||
@@ -122,21 +124,21 @@ class Button extends UIBlock
|
||||
$this->sColor = $sColor;
|
||||
$this->sJsCode = $sJsCode;
|
||||
$this->sOnClickJsCode = $sOnClickJsCode;
|
||||
|
||||
|
||||
parent::__construct($sId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetLabel(): string
|
||||
public function GetLabel()
|
||||
{
|
||||
return $this->sLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sLabel
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetLabel(string $sLabel)
|
||||
@@ -290,12 +292,13 @@ class Button extends UIBlock
|
||||
|
||||
/**
|
||||
* @param string $sOnClickJsCode
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetOnClickJsCode($sOnClickJsCode)
|
||||
public function SetOnClickJsCode(string $sOnClickJsCode)
|
||||
{
|
||||
$this->sOnClickJsCode = $sOnClickJsCode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -309,12 +312,13 @@ class Button extends UIBlock
|
||||
|
||||
/**
|
||||
* @param string $sJsCode
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetJsCode($sJsCode)
|
||||
public function SetJsCode(string $sJsCode)
|
||||
{
|
||||
$this->sJsCode = $sJsCode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ class ButtonFactory
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Component\Button\Button
|
||||
*/
|
||||
public static function MakeNeutral(string $sLabel, string $sName): Button
|
||||
public static function MakeNeutral(string $sLabel, string $sName)
|
||||
{
|
||||
$oButton = new Button($sLabel);
|
||||
$oButton->SetActionType(Button::ENUM_ACTION_TYPE_REGULAR)
|
||||
@@ -58,7 +58,7 @@ class ButtonFactory
|
||||
* @return \Combodo\iTop\Application\UI\Component\Button\Button
|
||||
*/
|
||||
public static function MakeForPrimaryAction(string $sLabel, string $sName = null, string $sValue = null, bool $bIsSubmit = false
|
||||
): Button {
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_PRIMARY, Button::ENUM_ACTION_TYPE_REGULAR, $sValue, $sName, $bIsSubmit);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class ButtonFactory
|
||||
* @return \Combodo\iTop\Application\UI\Component\Button\Button
|
||||
*/
|
||||
public static function MakeForSecondaryAction(string $sLabel, string $sName = null, string $sValue = null, bool $bIsSubmit = false
|
||||
): Button {
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SECONDARY, Button::ENUM_ACTION_TYPE_REGULAR, $sValue, $sName, $bIsSubmit);
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ class ButtonFactory
|
||||
* @return \Combodo\iTop\Application\UI\Component\Button\Button
|
||||
*/
|
||||
public static function MakeForValidationAction(string $sLabel, string $sName = null, string $sValue = null, bool $bIsSubmit = false
|
||||
): Button {
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_VALIDATION, Button::ENUM_ACTION_TYPE_REGULAR, $sValue, $sName, $bIsSubmit);
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ class ButtonFactory
|
||||
* @return \Combodo\iTop\Application\UI\Component\Button\Button
|
||||
*/
|
||||
public static function MakeForDestructiveAction(string $sLabel, string $sName = null, string $sValue = null, bool $bIsSubmit = false
|
||||
): Button {
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_DESTRUCTIVE, Button::ENUM_ACTION_TYPE_REGULAR, $sValue, $sName,
|
||||
$bIsSubmit);
|
||||
}
|
||||
@@ -118,7 +118,7 @@ class ButtonFactory
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Component\Button\Button
|
||||
*/
|
||||
public static function MakeAlternativeNeutral(string $sLabel, string $sName): Button
|
||||
public static function MakeAlternativeNeutral(string $sLabel, string $sName)
|
||||
{
|
||||
$oButton = new Button($sLabel);
|
||||
$oButton->SetActionType(Button::ENUM_ACTION_TYPE_ALTERNATIVE)
|
||||
@@ -141,7 +141,7 @@ class ButtonFactory
|
||||
*/
|
||||
public static function MakeForAlternativePrimaryAction(
|
||||
string $sLabel, string $sName = null, string $sValue = null, bool $bIsSubmit = false
|
||||
): Button {
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_PRIMARY, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
|
||||
$bIsSubmit);
|
||||
}
|
||||
@@ -158,7 +158,7 @@ class ButtonFactory
|
||||
*/
|
||||
public static function MakeForAlternativeSecondaryAction(
|
||||
string $sLabel, string $sName = null, string $sValue = null, bool $bIsSubmit = false
|
||||
): Button {
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SECONDARY, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
|
||||
$bIsSubmit);
|
||||
}
|
||||
@@ -175,7 +175,7 @@ class ButtonFactory
|
||||
*/
|
||||
public static function MakeForAlternativeValidationAction(
|
||||
string $sLabel, string $sName = null, string $sValue = null, bool $bIsSubmit = false
|
||||
): Button {
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_VALIDATION, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
|
||||
$bIsSubmit);
|
||||
}
|
||||
@@ -192,7 +192,7 @@ class ButtonFactory
|
||||
*/
|
||||
public static function MakeForAlternativeDestructiveAction(
|
||||
string $sLabel, string $sName = null, string $sValue = null, bool $bIsSubmit = false
|
||||
): Button {
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_DESTRUCTIVE, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
|
||||
$bIsSubmit);
|
||||
}
|
||||
@@ -212,7 +212,7 @@ class ButtonFactory
|
||||
*/
|
||||
protected static function MakeForAction(
|
||||
string $sLabel, string $sColor, string $sActionType, string $sValue = null, string $sName = null, bool $bIsSubmit = false
|
||||
): Button {
|
||||
) {
|
||||
$oButton = new Button($sLabel);
|
||||
$oButton->SetActionType($sActionType)
|
||||
->SetColor($sColor);
|
||||
|
||||
@@ -56,7 +56,7 @@ class GlobalSearch extends UIBlock
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct($aLastQueries = [], $sId = null)
|
||||
public function __construct(array $aLastQueries = [], ?string $sId = null)
|
||||
{
|
||||
parent::__construct($sId);
|
||||
$this->SetEndpoint(static::DEFAULT_ENDPOINT_REL_URL);
|
||||
@@ -73,9 +73,10 @@ class GlobalSearch extends UIBlock
|
||||
* @return $this
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function SetEndpoint($sEndpoint, $bRelativeUrl = true)
|
||||
public function SetEndpoint(string $sEndpoint, bool $bRelativeUrl = true)
|
||||
{
|
||||
$this->sEndpoint = (($bRelativeUrl) ? utils::GetAbsoluteUrlAppRoot() : '') . $sEndpoint;
|
||||
$this->sEndpoint = (($bRelativeUrl) ? utils::GetAbsoluteUrlAppRoot() : '').$sEndpoint;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -97,9 +98,10 @@ class GlobalSearch extends UIBlock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetLastQueries($aLastQueries)
|
||||
public function SetLastQueries(array $aLastQueries)
|
||||
{
|
||||
$this->aLastQueries = $aLastQueries;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,14 +51,14 @@ class GlobalSearchHelper
|
||||
* @throws \Exception
|
||||
* @noinspection PhpUnused Called by /pages/UI.php and extensions overloading the global search
|
||||
*/
|
||||
public static function AddQueryToHistory($sQuery, $sIconRelUrl = null, $sLabelAsHtml = null)
|
||||
public static function AddQueryToHistory(string $sQuery, ?string $sIconRelUrl = null, ?string $sLabelAsHtml = null)
|
||||
{
|
||||
$aNewEntry = [
|
||||
'query' => $sQuery,
|
||||
];
|
||||
|
||||
// Set icon only when necessary
|
||||
if(!empty($sIconRelUrl))
|
||||
if (!empty($sIconRelUrl))
|
||||
{
|
||||
//Ensure URL is relative to limit space in the preferences and avoid broken links in case app_root_url changes
|
||||
$aNewEntry['icon_url'] = str_replace(utils::GetAbsoluteUrlAppRoot(), '', $sIconRelUrl);
|
||||
|
||||
@@ -44,7 +44,7 @@ class Html extends UIBlock
|
||||
* @param string $sHtml
|
||||
* @param string|null $sId
|
||||
*/
|
||||
public function __construct($sHtml = '', $sId = null)
|
||||
public function __construct(string $sHtml = '', ?string $sId = null)
|
||||
{
|
||||
$this->sHtml = $sHtml;
|
||||
parent::__construct($sId);
|
||||
@@ -67,9 +67,10 @@ class Html extends UIBlock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetHtml($sHtml)
|
||||
public function SetHtml(string $sHtml)
|
||||
{
|
||||
$this->sHtml = $sHtml;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@
|
||||
namespace Combodo\iTop\Application\UI\Component\Panel;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\iUIBlock;
|
||||
use Combodo\iTop\Application\UI\UIBlock;
|
||||
|
||||
/**
|
||||
@@ -90,7 +91,7 @@ class Panel extends UIBlock
|
||||
* @param string $sColor
|
||||
* @param string|null $sId
|
||||
*/
|
||||
public function __construct($sTitle = '', $aSubBlocks = [], $sColor = self::DEFAULT_COLOR, $sId = null)
|
||||
public function __construct(string $sTitle = '', array $aSubBlocks = [], string $sColor = self::DEFAULT_COLOR, ?string $sId = null)
|
||||
{
|
||||
$this->sTitle = $sTitle;
|
||||
$this->aSubBlocks = $aSubBlocks;
|
||||
@@ -108,9 +109,10 @@ class Panel extends UIBlock
|
||||
|
||||
/**
|
||||
* @param string $sTitle
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetTitle($sTitle)
|
||||
public function SetTitle(string $sTitle)
|
||||
{
|
||||
$this->sTitle = $sTitle;
|
||||
|
||||
@@ -132,7 +134,7 @@ class Panel extends UIBlock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetSubBlocks($aSubBlocks)
|
||||
public function SetSubBlocks(array $aSubBlocks)
|
||||
{
|
||||
foreach ($aSubBlocks as $oSubBlock)
|
||||
{
|
||||
@@ -149,7 +151,7 @@ class Panel extends UIBlock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function AddSubBlock($oSubBlock)
|
||||
public function AddSubBlock(iUIBlock $oSubBlock)
|
||||
{
|
||||
$this->aSubBlocks[$oSubBlock->GetId()] = $oSubBlock;
|
||||
|
||||
@@ -164,7 +166,7 @@ class Panel extends UIBlock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function RemoveSubBlock($sId)
|
||||
public function RemoveSubBlock(string $sId)
|
||||
{
|
||||
if (array_key_exists($sId, $this->aSubBlocks))
|
||||
{
|
||||
@@ -184,11 +186,13 @@ class Panel extends UIBlock
|
||||
|
||||
/**
|
||||
* @param string $sColor
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetColor($sColor)
|
||||
public function SetColor(string $sColor)
|
||||
{
|
||||
$this->sColor = $sColor;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@ class PanelFactory
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Component\Panel\Panel
|
||||
*/
|
||||
public static function MakeNeutral($sTitle)
|
||||
public static function MakeNeutral(string $sTitle)
|
||||
{
|
||||
$oPanel = new Panel($sTitle);
|
||||
$oPanel->SetColor(Panel::ENUM_COLOR_NEUTRAL);
|
||||
@@ -51,7 +51,7 @@ class PanelFactory
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Component\Panel\Panel
|
||||
*/
|
||||
public static function MakeForInformation($sTitle)
|
||||
public static function MakeForInformation(string $sTitle)
|
||||
{
|
||||
$oPanel = new Panel($sTitle);
|
||||
$oPanel->SetColor(Panel::ENUM_COLOR_INFORMATION);
|
||||
@@ -66,7 +66,7 @@ class PanelFactory
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Component\Panel\Panel
|
||||
*/
|
||||
public static function MakeForSuccess($sTitle)
|
||||
public static function MakeForSuccess(string $sTitle)
|
||||
{
|
||||
$oPanel = new Panel($sTitle);
|
||||
$oPanel->SetColor(Panel::ENUM_COLOR_SUCCESS);
|
||||
@@ -81,7 +81,7 @@ class PanelFactory
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Component\Panel\Panel
|
||||
*/
|
||||
public static function MakeForWarning($sTitle)
|
||||
public static function MakeForWarning(string $sTitle)
|
||||
{
|
||||
$oPanel = new Panel($sTitle);
|
||||
$oPanel->SetColor(Panel::ENUM_COLOR_WARNING);
|
||||
@@ -96,7 +96,7 @@ class PanelFactory
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Component\Panel\Panel
|
||||
*/
|
||||
public static function MakeForDanger($sTitle)
|
||||
public static function MakeForDanger(string $sTitle)
|
||||
{
|
||||
$oPanel = new Panel($sTitle);
|
||||
$oPanel->SetColor(Panel::ENUM_COLOR_DANGER);
|
||||
@@ -111,7 +111,7 @@ class PanelFactory
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Component\Panel\Panel
|
||||
*/
|
||||
public static function MakeForFailure($sTitle)
|
||||
public static function MakeForFailure(string $sTitle)
|
||||
{
|
||||
$oPanel = new Panel($sTitle);
|
||||
$oPanel->SetColor(Panel::ENUM_COLOR_FAILURE);
|
||||
@@ -126,7 +126,7 @@ class PanelFactory
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Component\Panel\Panel
|
||||
*/
|
||||
public static function MakeWithBrandingPrimaryColor($sTitle)
|
||||
public static function MakeWithBrandingPrimaryColor(string $sTitle)
|
||||
{
|
||||
$oPanel = new Panel($sTitle);
|
||||
$oPanel->SetColor(Panel::ENUM_COLOR_PRIMARY);
|
||||
@@ -141,7 +141,7 @@ class PanelFactory
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Component\Panel\Panel
|
||||
*/
|
||||
public static function MakeWithBrandingSecondaryColor($sTitle)
|
||||
public static function MakeWithBrandingSecondaryColor(string $sTitle)
|
||||
{
|
||||
$oPanel = new Panel($sTitle);
|
||||
$oPanel->SetColor(Panel::ENUM_COLOR_SECONDARY);
|
||||
|
||||
@@ -49,9 +49,10 @@ class NewsroomMenu extends PopoverMenu
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetParams($aParams)
|
||||
public function SetParams(array $aParams)
|
||||
{
|
||||
$this->aParams = $aParams;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ class PopoverMenu extends UIBlock
|
||||
*
|
||||
* @param string|null $sId
|
||||
*/
|
||||
public function __construct($sId = null)
|
||||
public function __construct(?string $sId = null)
|
||||
{
|
||||
parent::__construct($sId);
|
||||
$this->aSections = [];
|
||||
@@ -63,7 +63,7 @@ class PopoverMenu extends UIBlock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function AddSection($sId)
|
||||
public function AddSection(string $sId)
|
||||
{
|
||||
if (false === $this->HasSection($sId))
|
||||
{
|
||||
@@ -84,7 +84,7 @@ class PopoverMenu extends UIBlock
|
||||
* @return $this
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function RemoveSection($sId)
|
||||
public function RemoveSection(string $sId)
|
||||
{
|
||||
if (true === $this->HasSection($sId))
|
||||
{
|
||||
@@ -101,7 +101,7 @@ class PopoverMenu extends UIBlock
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function HasSection($sId)
|
||||
public function HasSection(string $sId)
|
||||
{
|
||||
return array_key_exists($sId, $this->aSections);
|
||||
}
|
||||
@@ -114,7 +114,7 @@ class PopoverMenu extends UIBlock
|
||||
* @return $this
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function ClearSection($sId)
|
||||
public function ClearSection(string $sId)
|
||||
{
|
||||
if (false === $this->HasSection($sId))
|
||||
{
|
||||
@@ -145,9 +145,9 @@ class PopoverMenu extends UIBlock
|
||||
* @return $this
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function AddItem($sSectionId, PopoverMenuItem $oItem)
|
||||
public function AddItem(string $sSectionId, PopoverMenuItem $oItem)
|
||||
{
|
||||
if(false === $this->HasSection($sSectionId))
|
||||
if (false === $this->HasSection($sSectionId))
|
||||
{
|
||||
throw new Exception('Could not add an item to the "'.$sSectionId.'" section has it does not seem to exist in the "'.$this->GetId().'" menu.');
|
||||
}
|
||||
@@ -167,14 +167,14 @@ class PopoverMenu extends UIBlock
|
||||
* @return $this
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function RemoveItem($sSectionId, $sItemId)
|
||||
public function RemoveItem(string $sSectionId, string $sItemId)
|
||||
{
|
||||
if(false === $this->HasSection($sSectionId))
|
||||
if (false === $this->HasSection($sSectionId))
|
||||
{
|
||||
throw new Exception('Could not remove en item from the "'.$sSectionId.'" as it does not seem to exist in the "'.$this->GetId().'" menu.');
|
||||
}
|
||||
|
||||
if(array_key_exists($sItemId, $this->aSections[$sSectionId]['aItems']))
|
||||
if (array_key_exists($sItemId, $this->aSections[$sSectionId]['aItems']))
|
||||
{
|
||||
unset($this->aSections[$sSectionId]['aItems'][$sItemId]);
|
||||
}
|
||||
@@ -191,9 +191,9 @@ class PopoverMenu extends UIBlock
|
||||
* @return $this
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function SetItems($sSectionId, $aItems)
|
||||
public function SetItems(string $sSectionId, array $aItems)
|
||||
{
|
||||
if(false === $this->HasSection($sSectionId))
|
||||
if (false === $this->HasSection($sSectionId))
|
||||
{
|
||||
throw new Exception('Could not set items to the "'.$sSectionId.'" section has it does not seem to exist in the "'.$this->GetId().'" menu.');
|
||||
}
|
||||
|
||||
@@ -52,14 +52,15 @@ class JsPopoverMenuItem extends PopoverMenuItem
|
||||
{
|
||||
return $this->oPopupMenuItem->GetUrl();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function GetJsFilesUrlRecursively($bAbsoluteUrl = false)
|
||||
public function GetJsFilesUrlRecursively(bool $bAbsoluteUrl = false)
|
||||
{
|
||||
$aJsFiles = array_merge(parent::GetJsFilesUrlRecursively($bAbsoluteUrl), $this->oPopupMenuItem->GetLinkedScripts());
|
||||
|
||||
return $aJsFiles;
|
||||
}
|
||||
}
|
||||
@@ -70,25 +70,29 @@ class PopoverMenuItem extends UIBlock
|
||||
|
||||
/**
|
||||
* @see \ApplicationPopupMenuItem::SetCssClasses()
|
||||
*
|
||||
* @param array $aCssClasses
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetCssClasses($aCssClasses)
|
||||
public function SetCssClasses(array $aCssClasses)
|
||||
{
|
||||
$this->oPopupMenuItem->SetCssClasses($aCssClasses);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see \ApplicationPopupMenuItem::AddCssClass()
|
||||
*
|
||||
* @param string $sCssClass
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function AddCssClass($sCssClass)
|
||||
public function AddCssClass(string $sCssClass)
|
||||
{
|
||||
$this->oPopupMenuItem->AddCssClass($sCssClass);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class QuickCreate extends UIBlock
|
||||
* @throws \CoreException
|
||||
* @throws \DictExceptionMissingString
|
||||
*/
|
||||
public function __construct($aLastClasses = [], $sId = null)
|
||||
public function __construct(array $aLastClasses = [], ?string $sId = null)
|
||||
{
|
||||
parent::__construct($sId);
|
||||
$this->aAvailableClasses = UserRights::GetAllowedClasses(UR_ACTION_CREATE, array('bizmodel'), true);
|
||||
@@ -86,9 +86,10 @@ class QuickCreate extends UIBlock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetLastClasses($aLastClasses)
|
||||
public function SetLastClasses(array $aLastClasses)
|
||||
{
|
||||
$this->aLastClasses = $aLastClasses;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,19 +49,19 @@ class QuickCreateHelper
|
||||
* @throws \MySQLException
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function AddClassToHistory($Class)
|
||||
public static function AddClassToHistory($sClass)
|
||||
{
|
||||
$aNewEntry = [
|
||||
'class' => $Class,
|
||||
'class' => $sClass,
|
||||
];
|
||||
|
||||
/** @var array $aHistoryEntries */
|
||||
$aHistoryEntries = appUserPreferences::GetPref(static::USER_PREF_CODE, []);
|
||||
|
||||
// Remove same entry from history to avoid duplicates
|
||||
for($iIdx = 0; $iIdx < count($aHistoryEntries); $iIdx++)
|
||||
for ($iIdx = 0; $iIdx < count($aHistoryEntries); $iIdx++)
|
||||
{
|
||||
if($aHistoryEntries[$iIdx]['class'] === $Class)
|
||||
if ($aHistoryEntries[$iIdx]['class'] === $sClass)
|
||||
{
|
||||
unset($aHistoryEntries[$iIdx]);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ class ActivityEntry extends UIBlock
|
||||
*
|
||||
* @throws \OQLException
|
||||
*/
|
||||
public function __construct(DateTime $oDateTime, $sAuthorLogin, $sContent = null, $sId = null)
|
||||
public function __construct(DateTime $oDateTime, string $sAuthorLogin, ?string $sContent = null, ?string $sId = null)
|
||||
{
|
||||
parent::__construct($sId);
|
||||
|
||||
@@ -97,7 +97,7 @@ class ActivityEntry extends UIBlock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetType($sType)
|
||||
public function SetType(string $sType)
|
||||
{
|
||||
$this->sType = $sType;
|
||||
|
||||
@@ -121,7 +121,7 @@ class ActivityEntry extends UIBlock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetDecorationClasses($sDecorationClasses)
|
||||
public function SetDecorationClasses(string $sDecorationClasses)
|
||||
{
|
||||
$this->sDecorationClasses = $sDecorationClasses;
|
||||
|
||||
@@ -145,9 +145,10 @@ class ActivityEntry extends UIBlock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetContent($sContent)
|
||||
public function SetContent(string $sContent)
|
||||
{
|
||||
$this->sContent = $sContent;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -202,7 +203,7 @@ class ActivityEntry extends UIBlock
|
||||
* @throws \OQLException
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function SetAuthor($sAuthorLogin)
|
||||
public function SetAuthor(string $sAuthorLogin)
|
||||
{
|
||||
$this->sAuthorLogin = $sAuthorLogin;
|
||||
// TODO 2.8.0: Check that this does not return '' when author is the CRON or an extension.
|
||||
@@ -263,9 +264,10 @@ class ActivityEntry extends UIBlock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
protected function SetOrigin($sOrigin)
|
||||
protected function SetOrigin(string $sOrigin)
|
||||
{
|
||||
$this->sOrigin = $sOrigin;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ class ActivityEntryFactory
|
||||
* @throws \CoreException
|
||||
* @throws \OQLException
|
||||
*/
|
||||
public static function MakeFromCaseLogEntryArray($sAttCode, $aOrmEntry)
|
||||
public static function MakeFromCaseLogEntryArray(string $sAttCode, array $aOrmEntry)
|
||||
{
|
||||
$oUser = MetaModel::GetObject('User', $aOrmEntry['user_id'], false, true);
|
||||
$sUserLogin = ($oUser === null) ? '' : $oUser->Get('login');
|
||||
|
||||
@@ -58,7 +58,7 @@ class CaseLogEntry extends ActivityEntry
|
||||
*
|
||||
* @throws \OQLException
|
||||
*/
|
||||
public function __construct(DateTime $oDateTime, $sAuthorLogin, $sAttCode, $sContent, $sId = null)
|
||||
public function __construct(DateTime $oDateTime, string $sAuthorLogin, string $sAttCode, string $sContent, ?string $sId = null)
|
||||
{
|
||||
parent::__construct($oDateTime, $sAuthorLogin, $sContent, $sId);
|
||||
|
||||
@@ -84,9 +84,10 @@ class CaseLogEntry extends ActivityEntry
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetCaseLogRank($iCaseLogRank)
|
||||
public function SetCaseLogRank(int $iCaseLogRank)
|
||||
{
|
||||
$this->iCaseLogRank = $iCaseLogRank;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class EditsEntry extends ActivityEntry
|
||||
*
|
||||
* @throws \OQLException
|
||||
*/
|
||||
public function __construct(DateTime $oDateTime, $sAuthorLogin, $sObjectClass, $sId = null)
|
||||
public function __construct(DateTime $oDateTime, string $sAuthorLogin, string $sObjectClass, ?string $sId = null)
|
||||
{
|
||||
parent::__construct($oDateTime, $sAuthorLogin, null, $sId);
|
||||
|
||||
@@ -82,7 +82,7 @@ class EditsEntry extends ActivityEntry
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetAttributes($aAttributes)
|
||||
public function SetAttributes(array $aAttributes)
|
||||
{
|
||||
$this->aAttributes = $aAttributes;
|
||||
|
||||
@@ -104,11 +104,12 @@ class EditsEntry extends ActivityEntry
|
||||
* Note that if an attribute with the same $sAttCode already exists, it will be replaced.
|
||||
*
|
||||
* @param string $sAttCode
|
||||
* @param string $sEditDescriptionAsHtml The description of the edit already in HTML, it MUSt have been sanitized first (Already in HTML because most of the time it comes from CMDBChangeOp::GetDescription())
|
||||
* @param string $sEditDescriptionAsHtml The description of the edit already in HTML, it MUSt have been sanitized first (Already in
|
||||
* HTML because most of the time it comes from CMDBChangeOp::GetDescription())
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function AddAttribute($sAttCode, $sEditDescriptionAsHtml)
|
||||
public function AddAttribute(string $sAttCode, string $sEditDescriptionAsHtml)
|
||||
{
|
||||
$this->aAttributes[$sAttCode] = [
|
||||
'code' => $sAttCode,
|
||||
@@ -125,9 +126,9 @@ class EditsEntry extends ActivityEntry
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function RemoveAttribute($sAttCode)
|
||||
public function RemoveAttribute(string $sAttCode)
|
||||
{
|
||||
if(array_key_exists($sAttCode, $this->aAttributes))
|
||||
if (array_key_exists($sAttCode, $this->aAttributes))
|
||||
{
|
||||
unset($this->aAttributes[$sAttCode]);
|
||||
}
|
||||
|
||||
@@ -62,8 +62,10 @@ class TransitionEntry extends ActivityEntry
|
||||
* @throws \CoreException
|
||||
* @throws \OQLException
|
||||
*/
|
||||
public function __construct(DateTime $oDateTime, $sAuthorLogin, $sObjectClass, $sOriginStateCode, $sTargetStateCode, $sId = null)
|
||||
{
|
||||
public function __construct(
|
||||
DateTime $oDateTime, string $sAuthorLogin, string $sObjectClass, string $sOriginStateCode, string $sTargetStateCode,
|
||||
?string $sId = null
|
||||
) {
|
||||
parent::__construct($oDateTime, $sAuthorLogin, null, $sId);
|
||||
|
||||
$this->SetOriginalState($sObjectClass, $sOriginStateCode);
|
||||
@@ -79,7 +81,7 @@ class TransitionEntry extends ActivityEntry
|
||||
* @return $this
|
||||
* @throws \CoreException
|
||||
*/
|
||||
public function SetOriginalState($sObjectClass, $sStateCode)
|
||||
public function SetOriginalState(string $sObjectClass, string $sStateCode)
|
||||
{
|
||||
$this->sOriginStateCode = $sStateCode;
|
||||
$this->sOriginStateLabel = MetaModel::GetStateLabel($sObjectClass, $sStateCode);
|
||||
@@ -116,7 +118,7 @@ class TransitionEntry extends ActivityEntry
|
||||
* @return $this
|
||||
* @throws \CoreException
|
||||
*/
|
||||
public function SetTargetState($sObjectClass, $sStateCode)
|
||||
public function SetTargetState(string $sObjectClass, string $sStateCode)
|
||||
{
|
||||
$this->sTargetStateCode = $sStateCode;
|
||||
$this->sTargetStateLabel = MetaModel::GetStateLabel($sObjectClass, $sStateCode);
|
||||
|
||||
@@ -66,7 +66,7 @@ class ActivityPanel extends UIBlock
|
||||
* @throws \CoreException
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct(DBObject $oObject, $aEntries = [], $sId = null)
|
||||
public function __construct(DBObject $oObject, array $aEntries = [], ?string $sId = null)
|
||||
{
|
||||
parent::__construct($sId);
|
||||
|
||||
@@ -122,15 +122,16 @@ class ActivityPanel extends UIBlock
|
||||
* @return $this
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function SetEntries($aEntries)
|
||||
public function SetEntries(array $aEntries)
|
||||
{
|
||||
// Reset entries
|
||||
$this->aEntries = [];
|
||||
|
||||
foreach($aEntries as $oEntry)
|
||||
foreach ($aEntries as $oEntry)
|
||||
{
|
||||
$this->AddEntry($oEntry);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -273,13 +274,13 @@ class ActivityPanel extends UIBlock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function RemoveEntry($sEntryId)
|
||||
public function RemoveEntry(string $sEntryId)
|
||||
{
|
||||
if(array_key_exists($sEntryId, $this->aEntries))
|
||||
if (array_key_exists($sEntryId, $this->aEntries))
|
||||
{
|
||||
// Recompute case logs metadata only if necessary
|
||||
$oEntry = $this->aEntries[$sEntryId];
|
||||
if($oEntry instanceof CaseLogEntry)
|
||||
if ($oEntry instanceof CaseLogEntry)
|
||||
{
|
||||
$sCaseLogAttCode = $oEntry->GetAttCode();
|
||||
$sAuthorLogin = $oEntry->GetAuthorLogin();
|
||||
@@ -339,10 +340,10 @@ class ActivityPanel extends UIBlock
|
||||
* @return $this
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function AddCaseLogTab($sAttCode)
|
||||
protected function AddCaseLogTab(string $sAttCode)
|
||||
{
|
||||
// Add case log only if not already existing
|
||||
if(!array_key_exists($sAttCode, $this->aCaseLogs))
|
||||
if (!array_key_exists($sAttCode, $this->aCaseLogs))
|
||||
{
|
||||
$this->aCaseLogs[$sAttCode] = [
|
||||
'rank' => count($this->aCaseLogs) + 1,
|
||||
@@ -363,9 +364,9 @@ class ActivityPanel extends UIBlock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
protected function RemoveCaseLogTab($sAttCode)
|
||||
protected function RemoveCaseLogTab(string $sAttCode)
|
||||
{
|
||||
if(array_key_exists($sAttCode, $this->aCaseLogs))
|
||||
if (array_key_exists($sAttCode, $this->aCaseLogs))
|
||||
{
|
||||
unset($this->aCaseLogs[$sAttCode]);
|
||||
}
|
||||
@@ -380,7 +381,7 @@ class ActivityPanel extends UIBlock
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function HasCaseLogTab($sAttCode)
|
||||
public function HasCaseLogTab(string $sAttCode)
|
||||
{
|
||||
return isset($this->aCaseLogs[$sAttCode]);
|
||||
}
|
||||
|
||||
@@ -83,8 +83,9 @@ class NavigationMenu extends UIBlock
|
||||
* @throws \MySQLException
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct(ApplicationContext $oAppContext, PopoverMenu $oUserMenu, NewsroomMenu $oNewsroomMenu = null, $sId = null)
|
||||
{
|
||||
public function __construct(
|
||||
ApplicationContext $oAppContext, PopoverMenu $oUserMenu, NewsroomMenu $oNewsroomMenu = null, ?string $sId = null
|
||||
) {
|
||||
parent::__construct($sId);
|
||||
|
||||
$this->sAppRevisionNumber = utils::GetAppRevisionNumber();
|
||||
|
||||
@@ -51,7 +51,7 @@ class PageContent extends UIBlock
|
||||
*
|
||||
* @param string|null $sId
|
||||
*/
|
||||
public function __construct($sId = null)
|
||||
public function __construct(?string $sId = null)
|
||||
{
|
||||
parent::__construct($sId);
|
||||
|
||||
@@ -66,9 +66,10 @@ class PageContent extends UIBlock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
protected function SetContentAreaBlocks($sAreaId, $aBlocks)
|
||||
protected function SetContentAreaBlocks(string $sAreaId, array $aBlocks)
|
||||
{
|
||||
$this->aContentAreasBlocks[$sAreaId] = $aBlocks;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -80,9 +81,9 @@ class PageContent extends UIBlock
|
||||
* @return \Combodo\iTop\Application\UI\iUIBlock[]
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function GetContentAreaBlocks($sAreaId)
|
||||
protected function GetContentAreaBlocks(string $sAreaId)
|
||||
{
|
||||
if(!array_key_exists($sAreaId, $this->aContentAreasBlocks))
|
||||
if (!array_key_exists($sAreaId, $this->aContentAreasBlocks))
|
||||
{
|
||||
throw new Exception('Could not retrieve blocks from content area "'.$sAreaId.'" as it does seem to exists for page content "'.$this->GetId().'"');
|
||||
}
|
||||
@@ -97,7 +98,7 @@ class PageContent extends UIBlock
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function IsExistingContentArea($sAreaId)
|
||||
protected function IsExistingContentArea(string $sAreaId)
|
||||
{
|
||||
return isset($this->aContentAreasBlocks[$sAreaId]);
|
||||
}
|
||||
@@ -111,14 +112,15 @@ class PageContent extends UIBlock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
protected function AddBlockToContentArea($sAreaId, iUIBlock $oBlock)
|
||||
protected function AddBlockToContentArea(string $sAreaId, iUIBlock $oBlock)
|
||||
{
|
||||
if(!array_key_exists($sAreaId, $this->aContentAreasBlocks))
|
||||
if (!array_key_exists($sAreaId, $this->aContentAreasBlocks))
|
||||
{
|
||||
$this->aContentAreasBlocks[$sAreaId] = [];
|
||||
}
|
||||
|
||||
$this->aContentAreasBlocks[$sAreaId][$oBlock->GetId()] = $oBlock;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -131,9 +133,9 @@ class PageContent extends UIBlock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
protected function RemoveBlockFromContentArea($sAreaId, $sBlockId)
|
||||
protected function RemoveBlockFromContentArea(string $sAreaId, string $sBlockId)
|
||||
{
|
||||
if(array_key_exists($sAreaId, $this->aContentAreasBlocks) && array_key_exists($sBlockId, $this->aContentAreasBlocks[$sAreaId]))
|
||||
if (array_key_exists($sAreaId, $this->aContentAreasBlocks) && array_key_exists($sBlockId, $this->aContentAreasBlocks[$sAreaId]))
|
||||
{
|
||||
unset($this->aContentAreasBlocks[$sAreaId][$sBlockId]);
|
||||
}
|
||||
@@ -159,9 +161,10 @@ class PageContent extends UIBlock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetMainBlocks($aBlocks)
|
||||
public function SetMainBlocks(array $aBlocks)
|
||||
{
|
||||
$this->SetContentAreaBlocks(static::ENUM_CONTENT_AREA_MAIN, $aBlocks);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -198,9 +201,10 @@ class PageContent extends UIBlock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function RemoveMainBlock($sBlockId)
|
||||
public function RemoveMainBlock(string $sBlockId)
|
||||
{
|
||||
$this->RemoveBlockFromContentArea(static::ENUM_CONTENT_AREA_MAIN, $sBlockId);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -211,9 +215,10 @@ class PageContent extends UIBlock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetExtraHtmlContent($sExtraHtmlContent)
|
||||
public function SetExtraHtmlContent(string $sExtraHtmlContent)
|
||||
{
|
||||
$this->sExtraHtmlContent = $sExtraHtmlContent;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ class PageContentWithSideContent extends PageContent
|
||||
*
|
||||
* @param string|null $sId
|
||||
*/
|
||||
public function __construct($sId = null)
|
||||
public function __construct(?string $sId = null)
|
||||
{
|
||||
parent::__construct($sId);
|
||||
|
||||
@@ -58,9 +58,10 @@ class PageContentWithSideContent extends PageContent
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetSideBlocks($aBlocks)
|
||||
public function SetSideBlocks(array $aBlocks)
|
||||
{
|
||||
$this->SetContentAreaBlocks(static::ENUM_CONTENT_AREA_SIDE, $aBlocks);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -97,9 +98,10 @@ class PageContentWithSideContent extends PageContent
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function RemoveSideBlock($sBlockId)
|
||||
public function RemoveSideBlock(string $sBlockId)
|
||||
{
|
||||
$this->RemoveBlockFromContentArea(static::ENUM_CONTENT_AREA_SIDE, $sBlockId);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@ class TopBarFactory
|
||||
* @throws \CoreUnexpectedValue
|
||||
* @throws \MySQLException
|
||||
*/
|
||||
public static function MakeStandard($aBreadcrumbsEntry = null)
|
||||
public static function MakeStandard(?array $aBreadcrumbsEntry = null)
|
||||
{
|
||||
$oTopBar = new TopBar(TopBar::BLOCK_CODE);
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ abstract class UIBlock implements iUIBlock
|
||||
*
|
||||
* @param string|null $sId
|
||||
*/
|
||||
public function __construct($sId = null)
|
||||
public function __construct(?string $sId = null)
|
||||
{
|
||||
$this->sId = ($sId !== null) ? $sId : $this->GenerateId();
|
||||
}
|
||||
@@ -161,7 +161,7 @@ abstract class UIBlock implements iUIBlock
|
||||
* @inheritDoc
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function GetJsFilesUrlRecursively($bAbsoluteUrl = false)
|
||||
public function GetJsFilesUrlRecursively(bool $bAbsoluteUrl = false)
|
||||
{
|
||||
return $this->GetFilesUrlRecursively(static::ENUM_BLOCK_FILES_TYPE_JS, $bAbsoluteUrl);
|
||||
}
|
||||
@@ -170,7 +170,7 @@ abstract class UIBlock implements iUIBlock
|
||||
* @inheritDoc
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function GetCssFilesUrlRecursively($bAbsoluteUrl = false)
|
||||
public function GetCssFilesUrlRecursively(bool $bAbsoluteUrl = false)
|
||||
{
|
||||
return $this->GetFilesUrlRecursively(static::ENUM_BLOCK_FILES_TYPE_CSS, $bAbsoluteUrl);
|
||||
}
|
||||
@@ -185,14 +185,14 @@ abstract class UIBlock implements iUIBlock
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function GetFilesUrlRecursively($sFilesType, $bAbsoluteUrl = false)
|
||||
protected function GetFilesUrlRecursively(string $sFilesType, bool $bAbsoluteUrl = false)
|
||||
{
|
||||
$aFiles = [];
|
||||
$sFilesRelPathMethodName = 'Get'.ucfirst($sFilesType).'FilesRelPaths';
|
||||
$sFilesAbsUrlMethodName = 'Get'.ucfirst($sFilesType).'FilesUrlRecursively';
|
||||
|
||||
// Files from the block itself
|
||||
foreach($this::$sFilesRelPathMethodName() as $sFilePath)
|
||||
foreach ($this::$sFilesRelPathMethodName() as $sFilePath)
|
||||
{
|
||||
$aFiles[] = (($bAbsoluteUrl === true) ? utils::GetAbsoluteUrlAppRoot() : '').$sFilePath;
|
||||
}
|
||||
|
||||
@@ -92,9 +92,9 @@ interface iUIBlock
|
||||
*
|
||||
* @param bool $bAbsoluteUrl
|
||||
*
|
||||
* @return array
|
||||
* @return string[]
|
||||
*/
|
||||
public function GetJsFilesUrlRecursively($bAbsoluteUrl = false);
|
||||
public function GetJsFilesUrlRecursively(bool $bAbsoluteUrl = false);
|
||||
|
||||
/**
|
||||
* Return an array of the CSS files URL necessary for the block and all its sub blocks.
|
||||
@@ -102,8 +102,8 @@ interface iUIBlock
|
||||
*
|
||||
* @param bool $bAbsoluteUrl
|
||||
*
|
||||
* @return array
|
||||
* @return string[]
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function GetCssFilesUrlRecursively($bAbsoluteUrl = false);
|
||||
public function GetCssFilesUrlRecursively(bool $bAbsoluteUrl = false);
|
||||
}
|
||||
Reference in New Issue
Block a user