1 | <?php |
||
34 | class Result |
||
35 | { |
||
36 | /** |
||
37 | * Status indicator for a success situation |
||
38 | */ |
||
39 | const STATUS_OK = 'OK'; |
||
40 | /** |
||
41 | * Status indicator for an informational message situation. |
||
42 | */ |
||
43 | const STATUS_INFO = 'INFO'; |
||
44 | /** |
||
45 | * Status indicator for a warning situation. |
||
46 | */ |
||
47 | const STATUS_WARN = 'WARN'; |
||
48 | /** |
||
49 | * Status indicator for an error response. |
||
50 | */ |
||
51 | const STATUS_ERROR = 'ERR'; |
||
52 | /** |
||
53 | * Status indicator for a FATAL error response. |
||
54 | */ |
||
55 | const STATUS_FATAL = 'FATAL'; |
||
56 | /** |
||
57 | * Status indicator for a response which could not be checked for warnings/errors. |
||
58 | */ |
||
59 | const STATUS_UNKNOWN = 'UNKNOWN'; |
||
60 | |||
61 | /** |
||
62 | * Status of the result |
||
63 | * |
||
64 | * see self::STATUS_* |
||
65 | * |
||
66 | * @var string |
||
67 | */ |
||
68 | public $status; |
||
69 | |||
70 | /** |
||
71 | * Array of errors or warnings found |
||
72 | * |
||
73 | * @var NotOk[] |
||
74 | */ |
||
75 | public $messages = []; |
||
76 | |||
77 | /** |
||
78 | * The actual result received after performing the web service call. |
||
79 | * |
||
80 | * @var \stdClass|array |
||
81 | */ |
||
82 | public $response; |
||
83 | |||
84 | /** |
||
85 | * The raw contents of the Soap Envelope received after performing the web service call. |
||
86 | * |
||
87 | * @var string |
||
88 | */ |
||
89 | public $responseXml; |
||
90 | |||
91 | /** |
||
92 | * Result constructor. |
||
93 | * |
||
94 | * @param SendResult $sendResult |
||
95 | * @param string $status |
||
96 | */ |
||
97 | 139 | public function __construct($sendResult, $status = self::STATUS_OK) |
|
103 | |||
104 | /** |
||
105 | * Sets error status. |
||
106 | * |
||
107 | * Will not override a more severe status. |
||
108 | * |
||
109 | * @param string $newStatus |
||
110 | */ |
||
111 | 2 | public function setStatus($newStatus) |
|
117 | |||
118 | /** |
||
119 | * Checks if new status is worse than current status |
||
120 | * |
||
121 | * @param string $newStatus |
||
122 | * @param string $currentStatus |
||
123 | * @return bool true if newStatus is worse than old status. |
||
124 | */ |
||
125 | 2 | protected function isWorseStatus($newStatus, $currentStatus) |
|
138 | } |
||
139 |