You are here

private static function Braintree_Util::_removeWildcardKeys in Commerce Braintree 7

removes wildcard entries from the invalid keys array

Parameters

array $validKeys:

<array $invalidKeys:

Return value

array

1 call to Braintree_Util::_removeWildcardKeys()
Braintree_Util::verifyKeys in braintree_php/lib/Braintree/Util.php
verify user request structure

File

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

Class

Braintree_Util
Braintree Utility methods

Code

private static function _removeWildcardKeys($validKeys, $invalidKeys) {
  foreach ($validKeys as $key) {
    if (stristr($key, '[_anyKey_]')) {
      $wildcardKey = str_replace('[_anyKey_]', '', $key);
      foreach ($invalidKeys as $index => $invalidKey) {
        if (stristr($invalidKey, $wildcardKey)) {
          unset($invalidKeys[$index]);
        }
      }
    }
  }
  return $invalidKeys;
}