You are here

public function Braintree_Error_ValidationErrorCollection::__construct in Commerce Braintree 7

@ignore

File

braintree_php/lib/Braintree/Error/ValidationErrorCollection.php, line 32

Class

Braintree_Error_ValidationErrorCollection
collection of errors enumerating all validation errors for a given request

Code

public function __construct($data) {
  foreach ($data as $key => $errorData) {

    // map errors to new collections recursively
    if ($key == 'errors') {
      foreach ($errorData as $error) {
        $this->_errors[] = new Braintree_Error_Validation($error);
      }
    }
    else {
      $this->_nested[$key] = new Braintree_Error_ValidationErrorCollection($errorData);
    }
  }
}