本文整理汇总了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;
}