Completed
Branch BUG-9464-payment-methods-myste... (4799f5)
by
unknown
351:53 queued 337:20
created

Rest_Exception   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 0
cbo 1
dl 0
loc 31
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A get_data() 0 3 1
A get_string_code() 0 3 1
1
<?php
2
namespace EventEspresso\core\libraries\rest_api;
3
/**
4
 *
5
 * Class Exception
6
 *
7
 * similar to EE's EE_Error, except has space to hold the "data" we
8
 * want to eventually pass to WP_Error
9
 *
10
 * @package         Event Espresso
11
 * @subpackage    
12
 * @author				Mike Nelson
13
 * @since		 	   $VID:$
14
 *
15
 */
16
if( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
17
	exit( 'No direct script access allowed' );
18
}
19
20
class Rest_Exception extends \EE_Error {
21
	/**
22
	 *
23
	 * @var array 
24
	 */
25
	protected $_wp_error_data = array();
26
	protected $_wp_error_code = '';
27
	public function __construct( $string_code, $message, $wp_error_data = array(), $previous = null ) {
28
		parent::__construct( 
29
			$message,
30
			500,
31
			$previous );
32
		$this->_wp_error_data = $wp_error_data;
33
		$this->_wp_error_code = $string_code;
34
	}
35
	
36
	/**
37
	 * Array of data that may have been set during the constructor, intended for WP_Error's data
38
	 * @return array
39
	 */
40
	public function get_data() {
41
		return $this->_wp_error_data;
42
	}
43
	/**
44
	 * Gets the error string
45
	 * @return string
46
	 */
47
	public function get_string_code() {
48
		return $this->_wp_error_code;
49
	}
50
}
51