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


PHP Braintree_Util::delimiterToCamelCase方法代码示例

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


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

示例1: _initializeFromArray

 /**
  * initializes instance properties from the keys/values of an array
  * @ignore
  * @access protected
  * @param array $attributes array of properties to set - single level
  * @return none
  */
 private function _initializeFromArray($attributes)
 {
     foreach ($attributes as $name => $value) {
         $varName = "_{$name}";
         $this->{$varName} = Braintree_Util::delimiterToCamelCase($value, '_');
     }
 }
开发者ID:kingsolmn,项目名称:CakePHP-Braintree-Plugin,代码行数:14,代码来源:Validation.php

示例2: _iteratorToArray

 /**
  * processes SimpleXMLIterator objects recursively
  *
  * @access protected
  * @param object $iterator
  * @return array xml converted to array
  */
 private static function _iteratorToArray($iterator)
 {
     $xmlArray = array();
     $value = null;
     // rewind the iterator and check if the position is valid
     // if not, return the string it contains
     $iterator->rewind();
     if (!$iterator->valid()) {
         return self::_typecastXmlValue($iterator);
     }
     for ($iterator->rewind(); $iterator->valid(); $iterator->next()) {
         $tmpArray = null;
         $value = null;
         // get the attribute type string for use in conditions below
         $attributeType = $iterator->attributes()->type;
         // extract the parent element via xpath query
         $parentElement = $iterator->xpath($iterator->key() . '/..');
         if ($parentElement[0] instanceof SimpleXMLIterator) {
             $parentElement = $parentElement[0];
             $parentKey = Braintree_Util::delimiterToCamelCase($parentElement->getName());
         } else {
             $parentElement = null;
         }
         if ($parentKey == "customFields") {
             $key = Braintree_Util::delimiterToUnderscore($iterator->key());
         } else {
             $key = Braintree_Util::delimiterToCamelCase($iterator->key());
         }
         // process children recursively
         if ($iterator->hasChildren()) {
             // return the child elements
             $value = self::_iteratorToArray($iterator->current());
             // if the element is an array type,
             // use numeric keys to allow multiple values
             if ($attributeType != 'array') {
                 $tmpArray[$key] = $value;
             }
         } else {
             // cast values according to attributes
             $tmpArray[$key] = self::_typecastXmlValue($iterator->current());
         }
         // set the output string
         $output = isset($value) ? $value : $tmpArray[$key];
         // determine if there are multiple tags of this name at the same level
         if (isset($parentElement) && $parentElement->attributes()->type == 'collection' && $iterator->hasChildren()) {
             $xmlArray[$key][] = $output;
             continue;
         }
         // if the element was an array type, output to a numbered key
         // otherwise, use the element name
         if ($attributeType == 'array') {
             $xmlArray[] = $output;
         } else {
             $xmlArray[$key] = $output;
         }
     }
     return $xmlArray;
 }
开发者ID:danielcoats,项目名称:schoolpress,代码行数:65,代码来源:Parser.php

示例3: _underscoreCustomField

 private static function _underscoreCustomField($groupByCustomField, $records)
 {
     $updatedRecords = array();
     foreach ($records as $record) {
         $camelized = Braintree_Util::delimiterToCamelCase($groupByCustomField);
         $record[$groupByCustomField] = $record[$camelized];
         unset($record[$camelized]);
         $updatedRecords[] = $record;
     }
     return $updatedRecords;
 }
开发者ID:bobstermyang,项目名称:communityfoodshare,代码行数:11,代码来源:SettlementBatchSummary.php

示例4: valueForHtmlField

 /**
  * return original value for a field
  * For example, if a user tried to submit 'invalid-email' in the html field transaction[customer][email],
  * $result->valueForHtmlField("transaction[customer][email]") would yield "invalid-email"
  *
  * @param string $field
  * @return string
  */
 public function valueForHtmlField($field)
 {
     $pieces = preg_split("/[\\[\\]]+/", $field, 0, PREG_SPLIT_NO_EMPTY);
     $params = $this->params;
     foreach (array_slice($pieces, 0, -1) as $key) {
         $params = $params[Braintree_Util::delimiterToCamelCase($key)];
     }
     $finalKey = Braintree_Util::delimiterToCamelCase(end($pieces));
     $fieldValue = isset($params[$finalKey]) ? $params[$finalKey] : null;
     return $fieldValue;
 }
开发者ID:kingsolmn,项目名称:CakePHP-Braintree-Plugin,代码行数:19,代码来源:Error.php

示例5: onHtmlField

 /**
  * return errors for the passed html field.
  * For example, $result->errors->onHtmlField("transaction[customer][last_name]")
  *
  * @param string $field
  * @return array
  */
 public function onHtmlField($field)
 {
     $pieces = preg_split("/[\\[\\]]+/", $field, 0, PREG_SPLIT_NO_EMPTY);
     $errors = $this;
     foreach (array_slice($pieces, 0, -1) as $key) {
         $errors = $errors->forKey(Braintree_Util::delimiterToCamelCase($key));
         if (!isset($errors)) {
             return array();
         }
     }
     $finalKey = Braintree_Util::delimiterToCamelCase(end($pieces));
     return $errors->onAttribute($finalKey);
 }
开发者ID:agency2016,项目名称:rothy_cloudynote,代码行数:20,代码来源:ErrorCollection.php


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