Completed
Push — master ( 16e812...ea693b )
by mains
02:48
created
php/Requests/libary/Requests/Exception/HTTP/505.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,8 @@
 block discarded – undo
10 10
  *
11 11
  * @package Requests
12 12
  */
13
-class Requests_Exception_HTTP_505 extends Requests_Exception_HTTP {
13
+class Requests_Exception_HTTP_505 extends Requests_Exception_HTTP
14
+{
14 15
 	/**
15 16
 	 * HTTP status code
16 17
 	 *
Please login to merge, or discard this patch.
php/Requests/libary/Requests/Exception/HTTP/403.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,8 @@
 block discarded – undo
10 10
  *
11 11
  * @package Requests
12 12
  */
13
-class Requests_Exception_HTTP_403 extends Requests_Exception_HTTP {
13
+class Requests_Exception_HTTP_403 extends Requests_Exception_HTTP
14
+{
14 15
 	/**
15 16
 	 * HTTP status code
16 17
 	 *
Please login to merge, or discard this patch.
php/Requests/libary/Requests/Exception/HTTP/304.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,8 @@
 block discarded – undo
10 10
  *
11 11
  * @package Requests
12 12
  */
13
-class Requests_Exception_HTTP_304 extends Requests_Exception_HTTP {
13
+class Requests_Exception_HTTP_304 extends Requests_Exception_HTTP
14
+{
14 15
 	/**
15 16
 	 * HTTP status code
16 17
 	 *
Please login to merge, or discard this patch.
php/Requests/libary/Requests/Exception/HTTP/400.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,8 @@
 block discarded – undo
10 10
  *
11 11
  * @package Requests
12 12
  */
13
-class Requests_Exception_HTTP_400 extends Requests_Exception_HTTP {
13
+class Requests_Exception_HTTP_400 extends Requests_Exception_HTTP
14
+{
14 15
 	/**
15 16
 	 * HTTP status code
16 17
 	 *
Please login to merge, or discard this patch.
php/Requests/libary/Requests/Exception/HTTP/404.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,8 @@
 block discarded – undo
10 10
  *
11 11
  * @package Requests
12 12
  */
13
-class Requests_Exception_HTTP_404 extends Requests_Exception_HTTP {
13
+class Requests_Exception_HTTP_404 extends Requests_Exception_HTTP
14
+{
14 15
 	/**
15 16
 	 * HTTP status code
16 17
 	 *
Please login to merge, or discard this patch.
php/Requests/libary/Requests/Exception/HTTP/417.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,8 @@
 block discarded – undo
10 10
  *
11 11
  * @package Requests
12 12
  */
13
-class Requests_Exception_HTTP_417 extends Requests_Exception_HTTP {
13
+class Requests_Exception_HTTP_417 extends Requests_Exception_HTTP
14
+{
14 15
 	/**
15 16
 	 * HTTP status code
16 17
 	 *
Please login to merge, or discard this patch.
php/Requests/libary/Requests/Exception/HTTP/305.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,8 @@
 block discarded – undo
10 10
  *
11 11
  * @package Requests
12 12
  */
13
-class Requests_Exception_HTTP_305 extends Requests_Exception_HTTP {
13
+class Requests_Exception_HTTP_305 extends Requests_Exception_HTTP
14
+{
14 15
 	/**
15 16
 	 * HTTP status code
16 17
 	 *
Please login to merge, or discard this patch.
php/Requests/libary/Requests/Hooks.php 1 patch
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -12,7 +12,8 @@  discard block
 block discarded – undo
12 12
  * @package Requests
13 13
  * @subpackage Utilities
14 14
  */
15
-class Requests_Hooks implements Requests_Hooker {
15
+class Requests_Hooks implements Requests_Hooker
16
+{
16 17
 	/**
17 18
 	 * Registered callbacks for each hook
18 19
 	 *
@@ -23,7 +24,8 @@  discard block
 block discarded – undo
23 24
 	/**
24 25
 	 * Constructor
25 26
 	 */
26
-	public function __construct() {
27
+	public function __construct()
28
+	{
27 29
 		// pass
28 30
 	}
29 31
 
@@ -34,11 +36,14 @@  discard block
 block discarded – undo
34 36
 	 * @param callback $callback Function/method to call on event
35 37
 	 * @param int $priority Priority number. <0 is executed earlier, >0 is executed later
36 38
 	 */
37
-	public function register($hook, $callback, $priority = 0) {
38
-		if (!isset($this->hooks[$hook])) {
39
+	public function register($hook, $callback, $priority = 0)
40
+	{
41
+		if (!isset($this->hooks[$hook]))
42
+		{
39 43
 			$this->hooks[$hook] = array();
40 44
 		}
41
-		if (!isset($this->hooks[$hook][$priority])) {
45
+		if (!isset($this->hooks[$hook][$priority]))
46
+		{
42 47
 			$this->hooks[$hook][$priority] = array();
43 48
 		}
44 49
 
@@ -52,13 +57,17 @@  discard block
 block discarded – undo
52 57
 	 * @param array $parameters Parameters to pass to callbacks
53 58
 	 * @return boolean Successfulness
54 59
 	 */
55
-	public function dispatch($hook, $parameters = array()) {
56
-		if (empty($this->hooks[$hook])) {
60
+	public function dispatch($hook, $parameters = array())
61
+	{
62
+		if (empty($this->hooks[$hook]))
63
+		{
57 64
 			return false;
58 65
 		}
59 66
 
60
-		foreach ($this->hooks[$hook] as $priority => $hooked) {
61
-			foreach ($hooked as $callback) {
67
+		foreach ($this->hooks[$hook] as $priority => $hooked)
68
+		{
69
+			foreach ($hooked as $callback)
70
+			{
62 71
 				call_user_func_array($callback, $parameters);
63 72
 			}
64 73
 		}
Please login to merge, or discard this patch.
php/Requests/libary/Requests/SSL.php 1 patch
Braces   +40 added lines, -20 removed lines patch added patch discarded remove patch
@@ -14,7 +14,8 @@  discard block
 block discarded – undo
14 14
  * @package Requests
15 15
  * @subpackage Utilities
16 16
  */
17
-class Requests_SSL {
17
+class Requests_SSL
18
+{
18 19
 	/**
19 20
 	 * Verify the certificate against common name and subject alternative names
20 21
 	 *
@@ -29,10 +30,12 @@  discard block
 block discarded – undo
29 30
 	 * @param array $cert Certificate data from openssl_x509_parse()
30 31
 	 * @return bool
31 32
 	 */
32
-	public static function verify_certificate($host, $cert) {
33
+	public static function verify_certificate($host, $cert)
34
+	{
33 35
 		// Calculate the valid wildcard match if the host is not an IP address
34 36
 		$parts = explode('.', $host);
35
-		if (ip2long($host) === false) {
37
+		if (ip2long($host) === false)
38
+		{
36 39
 			$parts[0] = '*';
37 40
 		}
38 41
 		$wildcard = implode('.', $parts);
@@ -40,11 +43,14 @@  discard block
 block discarded – undo
40 43
 		$has_dns_alt = false;
41 44
 
42 45
 		// Check the subjectAltName
43
-		if (!empty($cert['extensions']) && !empty($cert['extensions']['subjectAltName'])) {
46
+		if (!empty($cert['extensions']) && !empty($cert['extensions']['subjectAltName']))
47
+		{
44 48
 			$altnames = explode(',', $cert['extensions']['subjectAltName']);
45
-			foreach ($altnames as $altname) {
49
+			foreach ($altnames as $altname)
50
+			{
46 51
 				$altname = trim($altname);
47
-				if (strpos($altname, 'DNS:') !== 0) {
52
+				if (strpos($altname, 'DNS:') !== 0)
53
+				{
48 54
 					continue;
49 55
 				}
50 56
 
@@ -54,7 +60,8 @@  discard block
 block discarded – undo
54 60
 				$altname = trim(substr($altname, 4));
55 61
 
56 62
 				// Check for a match
57
-				if (self::match_domain($host, $altname) === true) {
63
+				if (self::match_domain($host, $altname) === true)
64
+				{
58 65
 					return true;
59 66
 				}
60 67
 			}
@@ -62,9 +69,11 @@  discard block
 block discarded – undo
62 69
 
63 70
 		// Fall back to checking the common name if we didn't get any dNSName
64 71
 		// alt names, as per RFC2818
65
-		if (!$has_dns_alt && !empty($cert['subject']['CN'])) {
72
+		if (!$has_dns_alt && !empty($cert['subject']['CN']))
73
+		{
66 74
 			// Check for a match
67
-			if (self::match_domain($host, $cert['subject']['CN']) === true) {
75
+			if (self::match_domain($host, $cert['subject']['CN']) === true)
76
+			{
68 77
 				return true;
69 78
 			}
70 79
 		}
@@ -88,27 +97,33 @@  discard block
 block discarded – undo
88 97
 	 * @param string $reference Reference dNSName
89 98
 	 * @return boolean Is the name valid?
90 99
 	 */
91
-	public static function verify_reference_name($reference) {
100
+	public static function verify_reference_name($reference)
101
+	{
92 102
 		$parts = explode('.', $reference);
93 103
 
94 104
 		// Check the first part of the name
95 105
 		$first = array_shift($parts);
96 106
 
97
-		if (strpos($first, '*') !== false) {
107
+		if (strpos($first, '*') !== false)
108
+		{
98 109
 			// Check that the wildcard is the full part
99
-			if ($first !== '*') {
110
+			if ($first !== '*')
111
+			{
100 112
 				return false;
101 113
 			}
102 114
 
103 115
 			// Check that we have at least 3 components (including first)
104
-			if (count($parts) < 2) {
116
+			if (count($parts) < 2)
117
+			{
105 118
 				return false;
106 119
 			}
107 120
 		}
108 121
 
109 122
 		// Check the remaining parts
110
-		foreach ($parts as $part) {
111
-			if (strpos($part, '*') !== false) {
123
+		foreach ($parts as $part)
124
+		{
125
+			if (strpos($part, '*') !== false)
126
+			{
112 127
 				return false;
113 128
 			}
114 129
 		}
@@ -124,25 +139,30 @@  discard block
 block discarded – undo
124 139
 	 * @param string $reference dNSName to match against
125 140
 	 * @return boolean Does the domain match?
126 141
 	 */
127
-	public static function match_domain($host, $reference) {
142
+	public static function match_domain($host, $reference)
143
+	{
128 144
 		// Check if the reference is blacklisted first
129
-		if (self::verify_reference_name($reference) !== true) {
145
+		if (self::verify_reference_name($reference) !== true)
146
+		{
130 147
 			return false;
131 148
 		}
132 149
 
133 150
 		// Check for a direct match
134
-		if ($host === $reference) {
151
+		if ($host === $reference)
152
+		{
135 153
 			return true;
136 154
 		}
137 155
 
138 156
 		// Calculate the valid wildcard match if the host is not an IP address
139 157
 		// Also validates that the host has 3 parts or more, as per Firefox's
140 158
 		// ruleset.
141
-		if (ip2long($host) === false) {
159
+		if (ip2long($host) === false)
160
+		{
142 161
 			$parts = explode('.', $host);
143 162
 			$parts[0] = '*';
144 163
 			$wildcard = implode('.', $parts);
145
-			if ($wildcard === $reference) {
164
+			if ($wildcard === $reference)
165
+			{
146 166
 				return true;
147 167
 			}
148 168
 		}
Please login to merge, or discard this patch.