Requests_Exception_Transport_cURL::getReason()   A
last analyzed

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
class Requests_Exception_Transport_cURL extends Requests_Exception_Transport {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
Coding Style introduced by
This class is not in CamelCase format.

Classes in PHP are usually named in CamelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. The whole name starts with a capital letter as well.

Thus the name database provider becomes DatabaseProvider.

Loading history...
4
5
	const EASY = 'cURLEasy';
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
6
	const MULTI = 'cURLMulti';
7
	const SHARE = 'cURLShare';
8
9
	/**
10
	 * cURL error code
11
	 *
12
	 * @var integer
13
	 */
14
	protected $code = -1;
15
16
	/**
17
	 * Which type of cURL error
18
	 *
19
	 * EASY|MULTI|SHARE
20
	 *
21
	 * @var string
22
	 */
23
	protected $type = 'Unknown';
24
25
	/**
26
	 * Clear text error message
27
	 *
28
	 * @var string
29
	 */
30
	protected $reason = 'Unknown';
31
32
	public function __construct($message, $type, $data = null, $code = 0) {
33
		if ($type !== null) {
34
			$this->type = $type;
35
		}
36
37
		if ($code !== null) {
38
			$this->code = $code;
39
		}
40
41
		if ($message !== null) {
42
			$this->reason = $message;
43
		}
44
45
		$message = sprintf('%d %s', $this->code, $this->reason);
0 ignored issues
show
Coding Style introduced by
Consider using a different name than the parameter $message. This often makes code more readable.
Loading history...
46
		parent::__construct($message, $this->type, $data, $this->code);
47
	}
48
49
	/**
50
	 * Get the error message
51
	 */
52
	public function getReason() {
53
		return $this->reason;
54
	}
55
56
}
0 ignored issues
show
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
57