当前位置: 首页>>代码示例>>PHP>>正文


PHP Filter::filters方法代码示例

本文整理汇总了PHP中Icinga\Data\Filter\Filter::filters方法的典型用法代码示例。如果您正苦于以下问题:PHP Filter::filters方法的具体用法?PHP Filter::filters怎么用?PHP Filter::filters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Icinga\Data\Filter\Filter的用法示例。


在下文中一共展示了Filter::filters方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: filterChainToArray

 protected function filterChainToArray(Filter $filter)
 {
     if ($filter instanceof FilterAnd) {
         $op = 'and';
     } elseif ($filter instanceof FilterOr) {
         $op = 'or';
     } elseif ($filter instanceof FilterNot) {
         $op = 'not';
     } else {
         throw new QueryException('Cannot render filter: %s', $filter);
     }
     $parts = array($op);
     if (!$filter->isEmpty()) {
         foreach ($filter->filters() as $f) {
             $parts[] = $this->filterToArray($f);
         }
     }
     return $parts;
 }
开发者ID:Thomas-Gelf,项目名称:icingaweb2-module-puppetdb,代码行数:19,代码来源:FilterRenderer.php

示例2: validateFilterColumns

 protected function validateFilterColumns(Filter $filter)
 {
     if ($filter->isExpression()) {
         $valid = false;
         foreach ($this->allowedColumns as $column) {
             if (is_callable($column)) {
                 if (call_user_func($column, $filter->getColumn())) {
                     $valid = true;
                     break;
                 }
             } elseif ($filter->getColumn() === $column) {
                 $valid = true;
                 break;
             }
         }
         if (!$valid) {
             throw new QueryException('Invalid filter column provided: %s', $filter->getColumn());
         }
     } else {
         foreach ($filter->filters() as $subFilter) {
             $this->validateFilterColumns($subFilter);
         }
     }
 }
开发者ID:JakobGM,项目名称:icingaweb2,代码行数:24,代码来源:FilterChain.php

示例3: resetSearchColumns

 protected function resetSearchColumns(Filter &$filter)
 {
     if ($filter->isChain()) {
         $filters =& $filter->filters();
         if (!($empty = empty($filters))) {
             foreach ($filters as $k => &$f) {
                 if (false === $this->resetSearchColumns($f)) {
                     unset($filters[$k]);
                 }
             }
         }
         return $empty || !empty($filters);
     }
     return $filter->isExpression() ? !(in_array($filter->getColumn(), $this->searchColumns) && $filter->getSign() === '=') : true;
 }
开发者ID:trigoesrodrigo,项目名称:icingaweb2,代码行数:15,代码来源:FilterEditor.php

示例4: requireFilterColumns

 protected function requireFilterColumns(Filter $filter)
 {
     if ($filter instanceof FilterExpression) {
         if ($filter->getExpression() === '*') {
             return;
             // Wildcard only filters are ignored so stop early here to avoid joining a table for nothing
         }
         $alias = $filter->getColumn();
         $this->requireColumn($alias);
         if ($this->isCustomvar($alias)) {
             $column = $this->getCustomvarColumnName($alias);
         } else {
             $column = $this->aliasToColumnName($alias);
         }
         if (isset($this->columnsWithoutCollation[$alias])) {
             $expression = $filter->getExpression();
             if (is_array($expression)) {
                 $filter->setExpression(array_map('strtolower', $expression));
             } else {
                 $filter->setExpression(strtolower($expression));
             }
         }
         $filter->setColumn($column);
     } else {
         foreach ($filter->filters() as $filter) {
             $this->requireFilterColumns($filter);
         }
     }
 }
开发者ID:ppuschmann,项目名称:icingaweb2,代码行数:29,代码来源:IdoQuery.php

示例5: lowerColumnsWithoutCollation

 /**
  * Recurse the given filter and ensure that any string conversion is case-insensitive
  *
  * @param Filter $filter
  */
 protected function lowerColumnsWithoutCollation(Filter $filter)
 {
     if ($filter instanceof FilterExpression) {
         if (in_array($filter->getColumn(), $this->columnsWithoutCollation) && strpos($filter->getColumn(), 'LOWER') !== 0) {
             $filter->setColumn('LOWER(' . $filter->getColumn() . ')');
             $expression = $filter->getExpression();
             if (is_array($expression)) {
                 $filter->setExpression(array_map('strtolower', $expression));
             } else {
                 $filter->setExpression(strtolower($expression));
             }
         }
     } else {
         foreach ($filter->filters() as $chainedFilter) {
             $this->lowerColumnsWithoutCollation($chainedFilter);
         }
     }
 }
开发者ID:hsanjuan,项目名称:icingaweb2,代码行数:23,代码来源:IdoQuery.php

示例6: renderFilter

 /**
  * Filter rendering
  *
  * Happens recursively, useful for filters and for Stats expressions
  *
  * @param Filter $filter    The filter that should be rendered
  * @param string $type      Filter type. Usually "Filter" or "Stats"
  * @param int    $level     Nesting level during recursion. Don't touch
  * @param bool   $keylookup Whether to resolve alias names
  *
  * @return string
  */
 protected function renderFilter(Filter $filter, $type = 'Filter', $level = 0, $keylookup = true)
 {
     $str = '';
     if ($filter instanceof FilterChain) {
         if ($filter instanceof FilterAnd) {
             $op = 'And';
         } elseif ($filter instanceof FilterOr) {
             $op = 'Or';
         } elseif ($filter instanceof FilterNot) {
             $op = 'Negate';
         } else {
             throw new IcingaException('Cannot render filter: %s', $filter);
         }
         $parts = array();
         if (!$filter->isEmpty()) {
             foreach ($filter->filters() as $f) {
                 $parts[] = $this->renderFilter($f, $type, $level + 1, $keylookup);
             }
             $str .= implode("\n", $parts);
             if ($type === 'Filter') {
                 if (count($parts) > 1) {
                     $str .= "\n" . $op . ': ' . count($parts);
                 }
             } else {
                 $str .= "\n" . $type . $op . ': ' . count($parts);
             }
         }
     } else {
         $str .= $type . ': ' . $this->renderFilterExpression($filter, $keylookup);
     }
     return $str;
 }
开发者ID:kobmaki,项目名称:icingaweb2,代码行数:44,代码来源:Query.php

示例7: addFilter

 public function addFilter(Filter $filter)
 {
     // TODO: This should be considered a quick fix only.
     //       Drop this entirely once support for Icinga\Data\Filter is available
     if ($filter->isExpression()) {
         $this->where($filter->getColumn(), $filter->getExpression());
     } elseif ($filter->isChain()) {
         foreach ($filter->filters() as $chainOrExpression) {
             $this->addFilter($chainOrExpression);
         }
     }
 }
开发者ID:JakobGM,项目名称:icingaweb2,代码行数:12,代码来源:LdapQuery.php


注:本文中的Icinga\Data\Filter\Filter::filters方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。