Skip to content

Commit e1b15c1

Browse files
committed
fix code format
1 parent f0e2260 commit e1b15c1

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

src/Upyun/Signature.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public static function getRestApiSignHeader($bucketConfig, $method, $remotePath,
5252
*
5353
* @return array
5454
*/
55-
public static function getPurgeSignHeader( Config $bucketConfig, $urlString) {
55+
public static function getPurgeSignHeader(Config $bucketConfig, $urlString) {
5656
$gmtDate = gmdate('D, d M Y H:i:s \G\M\T');
5757
$sign = md5("$urlString&{$bucketConfig->bucketName}&$gmtDate&{$bucketConfig->operatorPassword}");
5858
return array(
@@ -73,16 +73,16 @@ public static function getFormSignature(Config $bucketConfig, $data) {
7373
}
7474

7575
public static function getSignature( Config $bucketConfig, $data, $type, $tokenSecret = '') {
76-
if(is_array($data)) {
76+
if (is_array($data)) {
7777
ksort($data);
7878
$string = '';
79-
foreach($data as $k => $v) {
80-
if(is_array($v)) {
79+
foreach ($data as $k => $v) {
80+
if (is_array($v)) {
8181
$v = implode('', $v);
8282
}
8383
$string .= "$k$v";
8484
}
85-
switch($type) {
85+
switch ($type) {
8686
case self::SIGN_MULTIPART:
8787
$string .= $tokenSecret ? $tokenSecret : $bucketConfig->getFormApiKey();
8888
break;
@@ -91,11 +91,10 @@ public static function getSignature( Config $bucketConfig, $data, $type, $tokenS
9191
break;
9292
case self::SIGN_VIDEO_NO_OPERATOR:
9393
break;
94-
9594
}
9695
$sign = md5($string);
9796
return $sign;
9897
}
9998
return false;
10099
}
101-
}
100+
}

src/Upyun/Uploader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ private function pointUpload($path, $stream, $params) {
5252
$req = new Rest($this->config);
5353
$headers = array();
5454
if (is_array($params)) {
55-
foreach($params as $key => $val) {
55+
foreach ($params as $key => $val) {
5656
$headers['X-Upyun-Meta-' . $key] = $val;
5757
}
5858
}
@@ -87,7 +87,7 @@ private function pointUpload($path, $stream, $params) {
8787
}
8888
$data = Util::getHeaderParams($res->getHeaders());
8989
$partId = $data['x-upyun-next-part-id'];
90-
} while($partId != -1);
90+
} while ($partId != -1);
9191

9292
$res = $req->request('PUT', $path)
9393
->withHeaders(array(

src/Upyun/Video.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function pretreat($source, $notifyUrl, $tasks) {
2525
$postParams,
2626
Signature::SIGN_VIDEO
2727
);
28-
28+
2929
$response = Request::post(
3030
sprintf('http://%s/%s/', Config::ED_VIDEO, 'pretreatment'),
3131
array('Authorization' => "UpYun {$this->config->operatorName}:$sign"),
@@ -45,7 +45,7 @@ public function pretreat($source, $notifyUrl, $tasks) {
4545

4646
public function status($taskIds) {
4747
$limit = 20;
48-
if(count($taskIds) <= $limit) {
48+
if (count($taskIds) <= $limit) {
4949
$taskIds = implode(',', $taskIds);
5050
} else {
5151
throw new \Exception('can not query more than ' . $limit . ' tasks at one time!');
@@ -85,13 +85,13 @@ public function callbackSignVerify() {
8585
'signature',
8686
);
8787
$callbackParams = array();
88-
foreach($callbackKeys as $key) {
89-
if(isset($_POST[$key])) {
88+
foreach ($callbackKeys as $key) {
89+
if (isset($_POST[$key])) {
9090
$callbackParams[$key] = Util::trim($_POST[$key]);
9191
}
9292
}
9393

94-
if(isset($callbackParams['signature'])) {
94+
if (isset($callbackParams['signature'])) {
9595
$sign = $callbackParams['signature'];
9696
unset($callbackParams['signature']);
9797
return $sign === Signature::getSignature(
@@ -101,7 +101,7 @@ public function callbackSignVerify() {
101101
);
102102
}
103103

104-
if(isset($data['non_signature'])) {
104+
if (isset($callbackParams['non_signature'])) {
105105
$sign = $callbackParams['non_signature'];
106106
unset($callbackParams['non_signature']);
107107
return $sign === Signature::getSignature(
@@ -112,4 +112,4 @@ public function callbackSignVerify() {
112112
}
113113
return false;
114114
}
115-
}
115+
}

0 commit comments

Comments
 (0)