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


PHP CArrayHelper::convertFieldToArray方法代码示例

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


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

示例1: formatDiscoveryRule

 /**
  * Format discovery rule.
  *
  * @param array $discoveryRule
  *
  * @return array
  */
 protected function formatDiscoveryRule(array $discoveryRule)
 {
     $discoveryRule = $this->renameItemFields($discoveryRule);
     if (!empty($discoveryRule['item_prototypes'])) {
         foreach ($discoveryRule['item_prototypes'] as &$prototype) {
             $prototype = $this->renameItemFields($prototype);
             CArrayHelper::convertFieldToArray($prototype, 'applications');
         }
         unset($prototype);
     } else {
         $discoveryRule['item_prototypes'] = array();
     }
     if (!empty($discoveryRule['trigger_prototypes'])) {
         foreach ($discoveryRule['trigger_prototypes'] as &$trigger) {
             $trigger = $this->renameTriggerFields($trigger);
         }
         unset($trigger);
     } else {
         $discoveryRule['trigger_prototypes'] = array();
     }
     if (!empty($discoveryRule['graph_prototypes'])) {
         foreach ($discoveryRule['graph_prototypes'] as &$graph) {
             $graph = $this->renameGraphFields($graph);
         }
         unset($graph);
     } else {
         $discoveryRule['graph_prototypes'] = array();
     }
     if (!empty($discoveryRule['host_prototypes'])) {
         foreach ($discoveryRule['host_prototypes'] as &$hostPrototype) {
             CArrayHelper::convertFieldToArray($hostPrototype, 'group_prototypes');
             CArrayHelper::convertFieldToArray($hostPrototype, 'templates');
         }
         unset($hostPrototype);
     } else {
         $discoveryRule['host_prototypes'] = array();
     }
     return $discoveryRule;
 }
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:46,代码来源:C20ImportFormatter.php

示例2: formatDiscoveryRule

 /**
  * Format discovery rule.
  *
  * @param array $discoveryRule
  *
  * @return array
  */
 protected function formatDiscoveryRule(array $discoveryRule)
 {
     $discoveryRule = $this->renameItemFields($discoveryRule);
     if (!empty($discoveryRule['item_prototypes'])) {
         foreach ($discoveryRule['item_prototypes'] as &$prototype) {
             $prototype = $this->renameItemFields($prototype);
             CArrayHelper::convertFieldToArray($prototype, 'applications');
         }
         unset($prototype);
     } else {
         $discoveryRule['item_prototypes'] = array();
     }
     if (!empty($discoveryRule['trigger_prototypes'])) {
         foreach ($discoveryRule['trigger_prototypes'] as &$trigger) {
             $trigger['expression'] = $this->triggerExpressionConverter->convert($trigger['expression']);
             $trigger = $this->renameTriggerFields($trigger);
         }
         unset($trigger);
     } else {
         $discoveryRule['trigger_prototypes'] = array();
     }
     if (!empty($discoveryRule['graph_prototypes'])) {
         foreach ($discoveryRule['graph_prototypes'] as &$graph) {
             $graph = $this->renameGraphFields($graph);
         }
         unset($graph);
     } else {
         $discoveryRule['graph_prototypes'] = array();
     }
     if (!empty($discoveryRule['host_prototypes'])) {
         foreach ($discoveryRule['host_prototypes'] as &$hostPrototype) {
             CArrayHelper::convertFieldToArray($hostPrototype, 'group_prototypes');
             CArrayHelper::convertFieldToArray($hostPrototype, 'templates');
         }
         unset($hostPrototype);
     } else {
         $discoveryRule['host_prototypes'] = array();
     }
     if (!empty($discoveryRule['filter'])) {
         // array filter structure
         if (is_array($discoveryRule['filter'])) {
             CArrayHelper::convertFieldToArray($discoveryRule['filter'], 'conditions');
         } else {
             list($filterMacro, $filterValue) = explode(':', $discoveryRule['filter']);
             if ($filterMacro) {
                 $discoveryRule['filter'] = array('evaltype' => CONDITION_EVAL_TYPE_AND_OR, 'formula' => '', 'conditions' => array(array('macro' => $filterMacro, 'value' => $filterValue, 'operator' => CONDITION_OPERATOR_REGEXP)));
             } else {
                 unset($discoveryRule['filter']);
             }
         }
     }
     return $discoveryRule;
 }
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:60,代码来源:C20ImportFormatter.php


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