Completed
Push — master ( 6cf2fc...de9661 )
by Roy
02:01
created

WC_Stripe_Exception::getLocalizedMessage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * WooCommerce Stripe Exception Class
4
 *
5
 * Extends Exception to provide additional data
6
 *
7
 * @since 4.0.2
8
 */
9
10
if ( ! defined( 'ABSPATH' ) ) {
11
	exit; // Exit if accessed directly
12
}
13
14
class WC_Stripe_Exception extends Exception {
15
16
	/** @var string sanitized/localized error message */
17
	protected $localized_message;
18
19
	/**
20
	 * Setup exception
21
	 *
22
	 * @since 4.0.2
23
	 * @param string $error_message Full response
24
	 * @param string $localized_message user-friendly translated error message
25
	 */
26
	public function __construct( $error_message = '', $localized_message = '' ) {
27
		$this->localized_message = $localized_message;
28
		parent::__construct( $error_message );
29
	}
30
31
	/**
32
	 * Returns the localized message.
33
	 *
34
	 * @since 4.0.2
35
	 * @return string
36
	 */
37
	public function getLocalizedMessage() {
38
		return $this->localized_message;
39
	}
40
}
41