PHP Class Braintree\Util

Show file Open project: braintree/braintree_php Class Usage Examples

Public Methods

Method Description
attributesToString ( $attributes )
buildClassName ( string $name ) : string
camelCaseToDelimiter ( string $string, null | string $delimiter = '-' ) : string find capitals and convert to delimiter + lowercase
camelCaseToDelimiterArray ( $array, $delimiter = '-' )
cleanClassName ( string $name ) : camelCased removes the header from a classname
delimiterToCamelCase ( string $string, null | string $delimiter = '[\-\_]' ) : string convert alpha-beta-gamma to alphaBetaGamma
delimiterToCamelCaseArray ( $array, $delimiter = '[\-\_]' )
delimiterToUnderscore ( string $string ) : string convert alpha-beta-gamma to alpha_beta_gamma
delimiterToUnderscoreArray ( $array )
extractAttributeAsArray ( array &$attribArray, string $attributeName ) : array extracts an attribute and returns an array of objects
implodeAssociativeArray ( array $array, string $separator = '=', string $glue = ', ' ) : boolean
returnObjectOrThrowException ( string $className, object $resultObj ) : object
throwStatusCodeException ( string $statusCode, null | string $message = null ) : void throws an exception based on the type of error
verifyKeys ( array $signature, array $attributes ) verify user request structure

Private Methods

Method Description
_flattenArray ( array $keys, string $namespace = null ) : array flattens a numerically indexed nested array to a single level
_flattenUserKeys ( $keys, $namespace = null )
_removeWildcardKeys ( array $validKeys, $invalidKeys ) : array removes wildcard entries from the invalid keys array

Method Details

attributesToString() public static method

public static attributesToString ( $attributes )

buildClassName() public static method

public static buildClassName ( string $name ) : string
$name string className
return string ClassName

camelCaseToDelimiter() public static method

find capitals and convert to delimiter + lowercase
public static camelCaseToDelimiter ( string $string, null | string $delimiter = '-' ) : string
$string string
$delimiter null | string
return string modified string

camelCaseToDelimiterArray() public static method

public static camelCaseToDelimiterArray ( $array, $delimiter = '-' )

cleanClassName() public static method

removes the header from a classname
public static cleanClassName ( string $name ) : camelCased
$name string ClassName
return camelCased classname minus header

delimiterToCamelCase() public static method

convert alpha-beta-gamma to alphaBetaGamma
public static delimiterToCamelCase ( string $string, null | string $delimiter = '[\-\_]' ) : string
$string string
$delimiter null | string
return string modified string

delimiterToCamelCaseArray() public static method

public static delimiterToCamelCaseArray ( $array, $delimiter = '[\-\_]' )

delimiterToUnderscore() public static method

convert alpha-beta-gamma to alpha_beta_gamma
public static delimiterToUnderscore ( string $string ) : string
$string string
return string modified string

delimiterToUnderscoreArray() public static method

public static delimiterToUnderscoreArray ( $array )

extractAttributeAsArray() public static method

extracts the requested element from an array, and converts the contents of its child arrays to objects of type $attributeName, or returns an array with a single element containing the value of that array element
public static extractAttributeAsArray ( array &$attribArray, string $attributeName ) : array
$attribArray array attributes from a search response
$attributeName string indicates which element of the passed array to extract
return array array of $attributeName objects, or a single element array

implodeAssociativeArray() public static method

public static implodeAssociativeArray ( array $array, string $separator = '=', string $glue = ', ' ) : boolean
$array array associative array to implode
$separator string (optional, defaults to =)
$glue string (optional, defaults to ', ')
return boolean

returnObjectOrThrowException() public static method

public static returnObjectOrThrowException ( string $className, object $resultObj ) : object
$className string
$resultObj object
return object returns the passed object if successful

throwStatusCodeException() public static method

throws an exception based on the type of error
public static throwStatusCodeException ( string $statusCode, null | string $message = null ) : void
$statusCode string HTTP status code to throw exception from
$message null | string
return void

verifyKeys() public static method

compares the expected signature of a gateway request against the actual structure sent by the user
public static verifyKeys ( array $signature, array $attributes )
$signature array
$attributes array