Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ErrorCodeProvider.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
10 use Braintree\Error\ErrorCollection;
11 use Braintree\Error\Validation;
12 use Braintree\Result\Error;
13 use Braintree\Result\Successful;
14 
19 {
26  public function getErrorCodes($response): array
27  {
28  $result = [];
29  if (!$response instanceof Error) {
30  return $result;
31  }
32 
34  $collection = $response->errors;
35 
37  foreach ($collection->deepAll() as $error) {
38  $result[] = $error->code;
39  }
40 
41  return $result;
42  }
43 }
$response
Definition: 404.php:11