Passed
Push — v6 ( 95b370...25ce72 )
by 光春
03:13
created
src/service/taobao/bin/top/ClusterTopClient.php 1 patch
Braces   +24 added lines, -17 removed lines patch added patch discarded remove patch
@@ -18,8 +18,9 @@  discard block
 block discarded – undo
18 18
 			unset($tmpConfig);
19 19
 
20 20
 			ClusterTopClient::$syncDate = $saveConfig['syncDate'];
21
-			if(!ClusterTopClient::$syncDate)
22
-				ClusterTopClient::$syncDate = 0;
21
+			if(!ClusterTopClient::$syncDate) {
22
+							ClusterTopClient::$syncDate = 0;
23
+			}
23 24
 		}
24 25
 	}
25 26
 
@@ -70,24 +71,29 @@  discard block
 block discarded – undo
70 71
 		}		
71 72
 		$currentEnv = $this->getEnvByApiName($apiname,$session);
72 73
 		$vip = $this->getVipByEnv($url,$currentEnv);
73
-		if($vip)
74
-			return $vip;
74
+		if($vip) {
75
+					return $vip;
76
+		}
75 77
 		return $url;
76 78
 	}
77 79
 
78 80
 	private function getVipByEnv($comUrl,$currentEnv){
79 81
 		$urlSchema = parse_url($comUrl);
80
-		if(!$urlSchema)
81
-			return null;
82
-		if(!ClusterTopClient::$dnsconfig['env'])
83
-			return null;
82
+		if(!$urlSchema) {
83
+					return null;
84
+		}
85
+		if(!ClusterTopClient::$dnsconfig['env']) {
86
+					return null;
87
+		}
84 88
 		
85
-		if(!array_key_exists($currentEnv,ClusterTopClient::$dnsconfig['env']))
86
-			return null;
89
+		if(!array_key_exists($currentEnv,ClusterTopClient::$dnsconfig['env'])) {
90
+					return null;
91
+		}
87 92
 
88 93
 		$hostList = ClusterTopClient::$dnsconfig['env'][$currentEnv];
89
-		if(!$hostList)
90
-			return null ;
94
+		if(!$hostList) {
95
+					return null ;
96
+		}
91 97
 
92 98
 		$vipList = null;
93 99
 		foreach ($hostList as $key => $value) {
@@ -114,7 +120,7 @@  discard block
 block discarded – undo
114 120
 					$flag = $this->getUserFlag($session);
115 121
 					if($userFlag && $flag ){
116 122
 						return $this->getEnvBySessionFlag($userFlag,$flag);
117
-					}else{
123
+					} else{
118 124
 						return $this->getRandomWeightElement($apiCfg['rule']);
119 125
 					}
120 126
 				}
@@ -127,7 +133,7 @@  discard block
 block discarded – undo
127 133
 		if($session && strlen($session) > 5){
128 134
 			if($session[0] == '6' || $session[0] == '7'){
129 135
 				return $session[strlen($session) -1];
130
-			}else if($session[0] == '5' || $session[0] == '8'){
136
+			} else if($session[0] == '5' || $session[0] == '8'){
131 137
 				return $session[5];
132 138
 			}
133 139
 		}
@@ -139,10 +145,11 @@  discard block
 block discarded – undo
139 145
 			$userConf = ClusterTopClient::$dnsconfig['user'];
140 146
 			$cfgArry = $userConf[$targetConfig];
141 147
 			foreach ($cfgArry as $key => $value) {
142
-				if(in_array($flag,$value))
143
-					return $key;
148
+				if(in_array($flag,$value)) {
149
+									return $key;
150
+				}
144 151
 			}
145
-		}else{
152
+		} else{
146 153
 			return null;
147 154
 		}
148 155
 	}
Please login to merge, or discard this patch.
src/service/taobao/bin/aliyun/AliyunClient.php 1 patch
Braces   +8 added lines, -11 removed lines patch added patch discarded remove patch
@@ -64,15 +64,13 @@  discard block
 block discarded – undo
64 64
 		try
65 65
 		{
66 66
 			$resp = $this->curl($requestUrl, null);
67
-		}
68
-		catch (Exception $e)
67
+		} catch (Exception $e)
69 68
 		{
70 69
 			$this->logCommunicationError($apiParams["Action"],$requestUrl,"HTTP_ERROR_" . $e->getCode(),$e->getMessage());
71 70
 			if ("json" == $this->format)
72 71
 			{
73 72
 				return  json_decode($e->getMessage());
74
-			}
75
-			else if("xml" == $this->format)
73
+			} else if("xml" == $this->format)
76 74
 			{
77 75
 				return  @simplexml_load_string($e->getMessage());
78 76
 			}
@@ -87,8 +85,7 @@  discard block
 block discarded – undo
87 85
 			{
88 86
 				$respWellFormed = true;
89 87
 			}
90
-		}
91
-		else if("xml" == $this->format)
88
+		} else if("xml" == $this->format)
92 89
 		{
93 90
 			$respObject = @simplexml_load_string($resp);
94 91
 			if (false !== $respObject)
@@ -203,11 +200,12 @@  discard block
 block discarded – undo
203 200
 			$postMultipart = false;
204 201
 			foreach ($postFields as $k => $v)
205 202
 			{
206
-				if("@" != substr($v, 0, 1))//判断是不是文件上传
203
+				if("@" != substr($v, 0, 1)) {
204
+				    //判断是不是文件上传
207 205
 				{
208
-					$postBodyString .= "$k=" . urlencode($v) . "&"; 
206
+					$postBodyString .= "$k=" . urlencode($v) . "&";
209 207
 				}
210
-				else//文件上传用multipart/form-data,否则用www-form-urlencoded
208
+				} else//文件上传用multipart/form-data,否则用www-form-urlencoded
211 209
 				{
212 210
 					$postMultipart = true;
213 211
 				}
@@ -217,8 +215,7 @@  discard block
 block discarded – undo
217 215
 			if ($postMultipart)
218 216
 			{
219 217
 				curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
220
-			}
221
-			else
218
+			} else
222 219
 			{
223 220
 				curl_setopt($ch, CURLOPT_POSTFIELDS, substr($postBodyString,0,-1));
224 221
 			}
Please login to merge, or discard this patch.