mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 15:34:12 +01:00
48 lines
1.0 KiB
PHP
48 lines
1.0 KiB
PHP
<?php
|
|
|
|
/*
|
|
* @copyright Copyright (C) 2010-2025 Combodo SAS
|
|
* @license http://opensource.org/licenses/AGPL-3.0
|
|
*/
|
|
|
|
namespace Combodo\iTop\Forms\Block\Expression;
|
|
|
|
use Combodo\iTop\Forms\Block\FormBlockException;
|
|
use Combodo\iTop\Forms\IO\Format\NumberIOFormat;
|
|
use Combodo\iTop\Forms\Register\IORegister;
|
|
|
|
/**
|
|
*
|
|
*/
|
|
class NumberExpressionFormBlock extends AbstractExpressionFormBlock
|
|
{
|
|
// Outputs
|
|
public const OUTPUT_RESULT = "result";
|
|
|
|
/** @inheritdoc */
|
|
protected function RegisterIO(IORegister $oIORegister): void
|
|
{
|
|
parent::RegisterIO($oIORegister);
|
|
$oIORegister->AddOutput(self::OUTPUT_RESULT, NumberIOFormat::class);
|
|
}
|
|
|
|
/**
|
|
* Compute the expression and set the output values.
|
|
*
|
|
* @param string $sEventType
|
|
*
|
|
* @return mixed
|
|
* @throws FormBlockException
|
|
*/
|
|
public function ComputeExpression(string $sEventType): mixed
|
|
{
|
|
$oResult = parent::ComputeExpression($sEventType);
|
|
|
|
// Update output
|
|
$this->GetOutput(self::OUTPUT_RESULT)->SetValue($sEventType, new NumberIOFormat($oResult));
|
|
|
|
return $oResult;
|
|
}
|
|
|
|
}
|