Source
private function validateHistFunctionExpressionRules(array $token, ?array $parent_token, ?int $position): bool {
<?php declare(strict_types = 0);
/*
** Zabbix
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/**
* Class for validating trigger expressions and calculated item formulas.
*/
class CExpressionValidator extends CValidator {
/**
* An options array.
*
* Supported options:
* 'usermacros' => false Enable user macros usage in function parameters.
* 'lldmacros' => false Enable low-level discovery macros usage in function parameters.
* 'calculated' => false Validate expression as part of calculated item formula.
* 'partial' => false Validate partial expression (relaxed requirements).
*
* @var array
*/
private $options = [
'usermacros' => false,
'lldmacros' => false,
'calculated' => false,
'partial' => false
];
/**
* Provider of information on math functions.
*
* @var CMathFunctionData
*/
private $math_function_data;
/**
* Known math functions along with number or range of required parameters.
*
* @var array
*/
private $math_function_parameters = [];
/**
* Known math functions along with additional requirements for usage in expressions.
*
* @var array
*/