1: <?php
2: namespace Hyperwallet\Model;
3:
4: /**
5: * Represents a V4 Error
6: *
7: * @package Hyperwallet\Model
8: */
9: class Error {
10:
11: /**
12: * The field name
13: *
14: * @var string
15: */
16: private $fieldName;
17:
18: /**
19: * The error message
20: *
21: * @var string
22: */
23: private $message;
24:
25: /**
26: * The error code
27: *
28: * @var string
29: */
30: private $code;
31:
32: /**
33: * The related resources
34: *
35: * @var array
36: */
37: private $relatedResources;
38:
39: /**
40: * Creates a instance of Error
41: *
42: * @param array $error A single error response map
43: */
44: public function __construct(array $error) {
45: $this->message = $error['message'];
46: $this->code = $error['code'];
47:
48: if (isset($error['fieldName'])) {
49: $this->fieldName = $error['fieldName'];
50: }
51:
52: if (isset($error['relatedResources'])) {
53: $this->relatedResources = $error['relatedResources'];
54: }
55: }
56:
57: /**
58: * Get the field name
59: *
60: * @return string
61: */
62: public function getFieldName() {
63: return $this->fieldName;
64: }
65:
66: /**
67: * Get the error message
68: *
69: * @return string
70: */
71: public function getMessage() {
72: return $this->message;
73: }
74:
75: /**
76: * Get the error code
77: *
78: * @return string
79: */
80: public function getCode() {
81: return $this->code;
82: }
83:
84: /**
85: * Get list of related resources
86: *
87: * @return array
88: */
89: public function getRelatedResources() {
90: return $this->relatedResources;
91: }
92: }
93: