You are here

public static function Braintree_Util::camelCaseToDelimiter in Commerce Braintree 7

find capitals and convert to delimiter + lowercase

@access public

Parameters

var $string:

Return value

var modified string

3 calls to Braintree_Util::camelCaseToDelimiter()
Braintree_TransparentRedirect::_underscoreKeys in braintree_php/lib/Braintree/TransparentRedirect.php
Braintree_Xml_Generator::arrayToXml in braintree_php/lib/Braintree/Xml/Generator.php
arrays passed to this method should have a single root element with an array as its value
Braintree_Xml_Generator::_createElementsFromArray in braintree_php/lib/Braintree/Xml/Generator.php
Construct XML elements with attributes from an associative array.

File

braintree_php/lib/Braintree/Util.php, line 142

Class

Braintree_Util
Braintree Utility methods

Code

public static function camelCaseToDelimiter($string, $delimiter = '-') {
  return preg_replace('/([A-Z])/e', '"' . $delimiter . '" . strtolower("$1")', $string);
}