Completed
Push — 1.11.x ( 518476...344d9e )
by José
55:02 queued 28:13
created

Requests_Exception   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 50
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getType() 0 3 1
A getData() 0 3 1
1
<?php
2
/**
3
 * Exception for HTTP requests
4
 *
5
 * @package Requests
6
 */
7
8
/**
9
 * Exception for HTTP requests
10
 *
11
 * @package Requests
12
 */
13
class Requests_Exception extends Exception {
14
	/**
15
	 * Type of exception
16
	 *
17
	 * @var string
18
	 */
19
	protected $type;
20
21
	/**
22
	 * Data associated with the exception
23
	 *
24
	 * @var mixed
25
	 */
26
	protected $data;
27
28
	/**
29
	 * Create a new exception
30
	 *
31
	 * @param string $message Exception message
32
	 * @param string $type Exception type
33
	 * @param mixed $data Associated data
34
	 * @param integer $code Exception numerical code, if applicable
35
	 */
36
	public function __construct($message, $type, $data = null, $code = 0) {
37
		parent::__construct($message, $code);
38
39
		$this->type = $type;
40
		$this->data = $data;
41
	}
42
43
	/**
44
	 * Like {@see getCode()}, but a string code.
45
	 *
46
	 * @codeCoverageIgnore
47
	 * @return string
48
	 */
49
	public function getType() {
50
		return $this->type;
51
	}
52
53
	/**
54
	 * Gives any relevant data
55
	 *
56
	 * @codeCoverageIgnore
57
	 * @return mixed
58
	 */
59
	public function getData() {
60
		return $this->data;
61
	}
62
}