Source
* Parses a host in a trigger function macro constant and moves a position ($pos) on a next symbol after the host.
<?php
/*
** 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 Affero General Public License as published by the Free Software Foundation, version 3.
**
** 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 Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
/**
* A parser for function macros like "{host:item.func()}".
*/
class C10FunctionMacroParser extends CParser {
/**
* An options array.
*
* Supported options:
* '18_simple_checks' => true with support for old-style simple checks like "ftp,{$PORT}"
* 'host_macro' Array of macro to be supported as host name.
*
* @var array
*/
private $options = [
'18_simple_checks' => false,
'host_macro' => []
];
/**
* Parser for item keys.
*
* @var CItemkey
*/
private $item_key_parser;
/**
* Parser for trigger functions.
*
* @var C10FunctionParser
*/
private $function_parser;
/**
* Parser for host names.
*
* @var CHostNameParser
*/
private $host_name_parser;
/**
* @var CSetParser
*/
private $host_macro_parser;
private $host = '';
private $item = '';