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


PHP Tx_Solr_Util::camelize方法代码示例

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


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

示例1: resolveVariableMarkers

 /**
  * Resolves variables to marker. Markers can be simple markers like
  * ###MY_MARKER## or "nested" markers which devide their sub values by a
  * dot: ###MY_MARKER.MY_VALUE### ###MY_MARKER.MY_OTHER_VALUE###.
  *
  * @param	array	array with markers to resolve
  * @param	mixed	the marker's value, which can be an array of values, an object with certain getter methods or a simple string
  * @return	array	with marker as index and value for it
  */
 protected function resolveVariableMarkers(array $markers, $variableValue)
 {
     $resolvedMarkers = array();
     $normalizedKeysArray = array();
     foreach ($variableValue as $key => $value) {
         $key = $this->normalizeString($key);
         $normalizedKeysArray[$key] = $value;
     }
     foreach ($markers as $marker) {
         $dotPosition = strpos($marker, '.');
         if ($dotPosition !== FALSE) {
             $resolvedValue = NULL;
             // the marker contains a dot, thus we have to resolve the
             // second part of the marker
             $valueSelector = substr($marker, $dotPosition + 1);
             $valueSelector = $this->normalizeString($valueSelector);
             if (is_array($variableValue) && array_key_exists($valueSelector, $normalizedKeysArray)) {
                 $resolvedValue = $normalizedKeysArray[$valueSelector];
             } elseif (is_object($variableValue)) {
                 $resolveMethod = 'get' . Tx_Solr_Util::camelize($valueSelector);
                 $resolvedValue = $variableValue->{$resolveMethod}();
             }
         } else {
             $resolvedValue = $variableValue[strtolower($marker)];
         }
         if (is_null($resolvedValue)) {
             if ($this->debugMode) {
                 $resolvedValue = '!!! Marker "' . $marker . '" could not be resolved.';
             } else {
                 $resolvedValue = '';
             }
         }
         if (is_array($resolvedValue)) {
             // handling multivalue fields, @see Tx_Solr_ViewHelper_Multivalue
             $resolvedValue = serialize($resolvedValue);
         }
         $resolvedMarkers[$marker] = $resolvedValue;
     }
     return $resolvedMarkers;
 }
开发者ID:punktDe,项目名称:solr,代码行数:49,代码来源:Template.php


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