Braintree\Util::cleanClassName PHP Method

cleanClassName() public static method

removes the header from a classname
public static cleanClassName ( string $name ) : camelCased
$name string ClassName
return camelCased classname minus header
    public static function cleanClassName($name)
    {
        $classNamesToResponseKeys = ['Braintree\\CreditCard' => 'creditCard', 'Braintree_CreditCard' => 'creditCard', 'Braintree\\CreditCardGateway' => 'creditCard', 'Braintree_CreditCardGateway' => 'creditCard', 'Braintree\\Customer' => 'customer', 'Braintree_Customer' => 'customer', 'Braintree\\CustomerGateway' => 'customer', 'Braintree_CustomerGateway' => 'customer', 'Braintree\\Subscription' => 'subscription', 'Braintree_Subscription' => 'subscription', 'Braintree\\SubscriptionGateway' => 'subscription', 'Braintree_SubscriptionGateway' => 'subscription', 'Braintree\\Transaction' => 'transaction', 'Braintree_Transaction' => 'transaction', 'Braintree\\TransactionGateway' => 'transaction', 'Braintree_TransactionGateway' => 'transaction', 'Braintree\\CreditCardVerification' => 'verification', 'Braintree_CreditCardVerification' => 'verification', 'Braintree\\CreditCardVerificationGateway' => 'verification', 'Braintree_CreditCardVerificationGateway' => 'verification', 'Braintree\\AddOn' => 'addOn', 'Braintree_AddOn' => 'addOn', 'Braintree\\AddOnGateway' => 'addOn', 'Braintree_AddOnGateway' => 'addOn', 'Braintree\\Discount' => 'discount', 'Braintree_Discount' => 'discount', 'Braintree\\DiscountGateway' => 'discount', 'Braintree_DiscountGateway' => 'discount', 'Braintree\\Plan' => 'plan', 'Braintree_Plan' => 'plan', 'Braintree\\PlanGateway' => 'plan', 'Braintree_PlanGateway' => 'plan', 'Braintree\\Address' => 'address', 'Braintree_Address' => 'address', 'Braintree\\AddressGateway' => 'address', 'Braintree_AddressGateway' => 'address', 'Braintree\\SettlementBatchSummary' => 'settlementBatchSummary', 'Braintree_SettlementBatchSummary' => 'settlementBatchSummary', 'Braintree\\SettlementBatchSummaryGateway' => 'settlementBatchSummary', 'Braintree_SettlementBatchSummaryGateway' => 'settlementBatchSummary', 'Braintree\\Merchant' => 'merchant', 'Braintree_Merchant' => 'merchant', 'Braintree\\MerchantGateway' => 'merchant', 'Braintree_MerchantGateway' => 'merchant', 'Braintree\\MerchantAccount' => 'merchantAccount', 'Braintree_MerchantAccount' => 'merchantAccount', 'Braintree\\MerchantAccountGateway' => 'merchantAccount', 'Braintree_MerchantAccountGateway' => 'merchantAccount', 'Braintree\\OAuthCredentials' => 'credentials', 'Braintree_OAuthCredentials' => 'credentials', 'Braintree\\OAuthResult' => 'result', 'Braintree_OAuthResult' => 'result', 'Braintree\\PayPalAccount' => 'paypalAccount', 'Braintree_PayPalAccount' => 'paypalAccount', 'Braintree\\PayPalAccountGateway' => 'paypalAccount', 'Braintree_PayPalAccountGateway' => 'paypalAccount'];
        return $classNamesToResponseKeys[$name];
    }

Usage Example

Example #1
0
 private function _mapPropertyNamesToObjsToReturn($propertyNames, $objsToReturn)
 {
     if (count($objsToReturn) != count($propertyNames)) {
         $propertyNames = [];
         foreach ($objsToReturn as $obj) {
             array_push($propertyNames, Util::cleanClassName(get_class($obj)));
         }
     }
     return array_combine($propertyNames, $objsToReturn);
 }
All Usage Examples Of Braintree\Util::cleanClassName