Source
* Parses a host in a trigger function macro constant and moves a position ($pos) on a next symbol after the host.
<?php
/*
** Zabbix
** Copyright (C) 2001-2022 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.
**/
/**
* 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;
private $host = '';
private $item = '';