Completed
Push — fixTravisCoverageReporting ( c1e84c )
by adam
02:34
created

UsageException::getApiCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1.037

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 3
cp 0.6667
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1.037
1
<?php
2
3
namespace Mediawiki\Api;
4
5
use Exception;
6
7
/**
8
 * Class representing a Mediawiki Api UsageException
9
 *
10
 * @since 0.1
11
 *
12
 * @author Addshore
13
 */
14
class UsageException extends Exception {
15
16
	/**
17
	 * @var string
18
	 */
19
	private $apiCode;
20
21
	/**
22
	 * @var array
23
	 */
24
	private $result;
25
26
	/**
27
	 * @since 0.1
28
	 *
29
	 * @param string $apiCode
30
	 * @param string $message
31
	 * @param array $result the result the exception was generated from
32
	 */
33 2
	public function __construct( $apiCode = '', $message = '', $result = array() ) {
34 2
		$this->apiCode = $apiCode;
35 2
		$this->result = $result;
36 2
		parent::__construct( $message, 0, null );
37 2
	}
38
39
	/**
40
	 * @since 0.1
41
	 *
42
	 * @return string
43
	 */
44 2
	public function getApiCode() {
45 2
		return $this->apiCode;
46
	}
47
48
	/**
49
	 * @since 0.3
50
	 *
51
	 * @return array
52
	 */
53 2
	public function getApiResult() {
54 2
		return $this->result;
55
	}
56
57
}
58