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

UsageException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 5
ccs 5
cts 5
cp 1
rs 9.4286
cc 1
eloc 4
nc 1
nop 3
crap 1
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