仰望星辰工作室

better-staridc-MNBT

better-staridc-MNBT/ wp_seller_plugin/includes/mnbt/class-exception.php 670 B · 45 行 原始文件
Z zfhsh first commit 2 个月前
1<?php
2/**
3 * MNBT 对接异常:错误归一化后统一抛出。
4 *
5 * @package MnbtWp
6 */
7
8namespace MnbtWp\Mnbt;
9
10if ( ! defined( 'ABSPATH' ) ) {
11 exit;
12}
13
14/**
15 * MNBT API 异常。
16 */
17class Exception extends \Exception {
18
19 /**
20 * 原始响应数据(脱敏后),便于上层记录上下文。
21 *
22 * @var array
23 */
24 protected $context = array();
25
26 /**
27 * 设置上下文。
28 *
29 * @param array $context 上下文。
30 * @return $this
31 */
32 public function set_context( array $context ) {
33 $this->context = $context;
34 return $this;
35 }
36
37 /**
38 * 获取上下文。
39 *
40 * @return array
41 */
42 public function get_context() {
43 return $this->context;
44 }
45}