本文整理汇总了PHP中Icinga\Data\Filter\Filter::matches方法的典型用法代码示例。如果您正苦于以下问题:PHP Filter::matches方法的具体用法?PHP Filter::matches怎么用?PHP Filter::matches使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Icinga\Data\Filter\Filter
的用法示例。
在下文中一共展示了Filter::matches方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: matches
/**
* Return whether this object matches the given filter
*
* @param Filter $filter
*
* @return bool
*
* @throws ProgrammingError In case the object cannot be found
*
* @deprecated Use $filter->matches($object) instead
*/
public function matches(Filter $filter)
{
if ($this->properties === null && $this->fetch() === false) {
throw new ProgrammingError('Unable to apply filter. Object %s of type %s not found.', $this->getName(), $this->getType());
}
return $filter->matches($this);
}
示例2: matches
public function matches(Filter $filter)
{
return $filter->matches($this->flattenProperties());
}
示例3: matches
/**
* Return whether this object matches the given filter
*
* @param Filter $filter
*
* @return bool
*
* @throws ProgrammingError In case the object cannot be found
*/
public function matches(Filter $filter)
{
if ($this->properties === null && $this->fetch() === false) {
throw new ProgrammingError('Unable to apply filter. Object %s of type %s not found.', $this->getName(), $this->getType());
}
$queryString = $filter->toQueryString();
$row = clone $this->properties;
if (strpos($queryString, '_host_') !== false || strpos($queryString, '_service_') !== false) {
if ($this->customvars === null) {
$this->fetchCustomvars();
}
foreach ($this->customvars as $name => $value) {
if (!is_object($value)) {
$row->{'_' . $this->getType() . '_' . $name} = $value;
}
}
}
if (strpos($queryString, 'hostgroup_name') !== false) {
if ($this->hostgroups === null) {
$this->fetchHostgroups();
}
$row->hostgroup_name = array_keys($this->hostgroups);
}
if (strpos($queryString, 'servicegroup_name') !== false) {
if ($this->servicegroups === null) {
$this->fetchServicegroups();
}
$row->servicegroup_name = array_keys($this->servicegroups);
}
return $filter->matches($row);
}