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

UsageException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 81.82%

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 3
c 4
b 0
f 0
lcom 0
cbo 0
dl 0
loc 44
ccs 9
cts 11
cp 0.8182
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getApiCode() 0 3 1
A getApiResult() 0 3 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