當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。