From 74742945f936ddcd0ad54236556dcc21a0f3921a Mon Sep 17 00:00:00 2001 From: oiuv Date: Sun, 29 Mar 2020 09:54:29 +0000 Subject: [PATCH] Apply fixes from StyleCI --- lib/ftp.cls.php | 2 +- lib/include/aliyunoss/samples/LiveChannel.php | 6 ++++-- lib/include/aliyunoss/samples/Signature.php | 14 ++++++++++---- .../src/OSS/Result/ListBucketsResult.php | 6 ++++-- .../OSS/Result/ListMultipartUploadResult.php | 15 ++++++++++++--- .../tests/OSS/Tests/CnameConfigTest.php | 3 ++- .../aliyunoss/tests/OSS/Tests/Common.php | 4 +++- .../tests/OSS/Tests/ListBucketsResultTest.php | 3 ++- .../tests/OSS/Tests/OssClientSignatureTest.php | 14 ++++++++++---- .../tests/OSS/Tests/TestOssClientBase.php | 4 +++- lib/include/sphinxapi.php | 18 +++++++++++++----- 11 files changed, 64 insertions(+), 25 deletions(-) diff --git a/lib/ftp.cls.php b/lib/ftp.cls.php index a37f8cd1..50944f18 100755 --- a/lib/ftp.cls.php +++ b/lib/ftp.cls.php @@ -37,7 +37,7 @@ public function __construct(&$G) * @param int $port 服务器端口,默认值为21 * @param bool $pasv 是否开启被动模式 * @param bool $ssl 是否使用SSL连接 - * @param int $timeout 超时时间  + * @param int $timeout 超时时间 */ public function connect($host, $username = '', $password = '', $port = '21', $pasv = false, $ssl = false, $timeout = 30) { diff --git a/lib/include/aliyunoss/samples/LiveChannel.php b/lib/include/aliyunoss/samples/LiveChannel.php index 401fd119..d950ea9a 100755 --- a/lib/include/aliyunoss/samples/LiveChannel.php +++ b/lib/include/aliyunoss/samples/LiveChannel.php @@ -127,8 +127,10 @@ * The playlist file is specified to “vod_playlist.m3u8”, which means that a palylist file named vod_playlist.m3u8 is created after the interface is called. */ $current_time = time(); -$ossClient->postVodPlaylist($bucket, - 'test_rtmp_live', 'vod_playlist.m3u8', +$ossClient->postVodPlaylist( + $bucket, + 'test_rtmp_live', + 'vod_playlist.m3u8', ['StartTime' => $current_time - 60, 'EndTime' => $current_time, ] ); diff --git a/lib/include/aliyunoss/samples/Signature.php b/lib/include/aliyunoss/samples/Signature.php index 4b67f85b..ecd0998d 100755 --- a/lib/include/aliyunoss/samples/Signature.php +++ b/lib/include/aliyunoss/samples/Signature.php @@ -115,8 +115,11 @@ function getSignedUrlForPuttingObject($ossClient, $bucket) $request->add_header('Content-Length', strlen($content)); $request->set_body($content); $request->send_request(); - $res = new ResponseCore($request->get_response_header(), - $request->get_response_body(), $request->get_response_code()); + $res = new ResponseCore( + $request->get_response_header(), + $request->get_response_body(), + $request->get_response_code() + ); if ($res->isOK()) { echo __FUNCTION__.': OK'."\n"; } else { @@ -155,8 +158,11 @@ function getSignedUrlForPuttingObjectFromFile($ossClient, $bucket) $request->set_read_file($file); $request->set_read_stream_size(filesize($file)); $request->send_request(); - $res = new ResponseCore($request->get_response_header(), - $request->get_response_body(), $request->get_response_code()); + $res = new ResponseCore( + $request->get_response_header(), + $request->get_response_body(), + $request->get_response_code() + ); if ($res->isOK()) { echo __FUNCTION__.': OK'."\n"; } else { diff --git a/lib/include/aliyunoss/src/OSS/Result/ListBucketsResult.php b/lib/include/aliyunoss/src/OSS/Result/ListBucketsResult.php index 7f86a274..f1e135a3 100755 --- a/lib/include/aliyunoss/src/OSS/Result/ListBucketsResult.php +++ b/lib/include/aliyunoss/src/OSS/Result/ListBucketsResult.php @@ -30,9 +30,11 @@ protected function parseDataFromResponse() $xml = new \SimpleXMLElement($content); if (isset($xml->Buckets) && isset($xml->Buckets->Bucket)) { foreach ($xml->Buckets->Bucket as $bucket) { - $bucketInfo = new BucketInfo(strval($bucket->Location), + $bucketInfo = new BucketInfo( + strval($bucket->Location), strval($bucket->Name), - strval($bucket->CreationDate)); + strval($bucket->CreationDate) + ); $bucketList[] = $bucketInfo; } } diff --git a/lib/include/aliyunoss/src/OSS/Result/ListMultipartUploadResult.php b/lib/include/aliyunoss/src/OSS/Result/ListMultipartUploadResult.php index 28127745..5f702e30 100755 --- a/lib/include/aliyunoss/src/OSS/Result/ListMultipartUploadResult.php +++ b/lib/include/aliyunoss/src/OSS/Result/ListMultipartUploadResult.php @@ -57,8 +57,17 @@ protected function parseDataFromResponse() } } - return new ListMultipartUploadInfo($bucket, $keyMarker, $uploadIdMarker, - $nextKeyMarker, $nextUploadIdMarker, - $delimiter, $prefix, $maxUploads, $isTruncated, $listUpload); + return new ListMultipartUploadInfo( + $bucket, + $keyMarker, + $uploadIdMarker, + $nextKeyMarker, + $nextUploadIdMarker, + $delimiter, + $prefix, + $maxUploads, + $isTruncated, + $listUpload + ); } } diff --git a/lib/include/aliyunoss/tests/OSS/Tests/CnameConfigTest.php b/lib/include/aliyunoss/tests/OSS/Tests/CnameConfigTest.php index 00142448..44b3b41e 100755 --- a/lib/include/aliyunoss/tests/OSS/Tests/CnameConfigTest.php +++ b/lib/include/aliyunoss/tests/OSS/Tests/CnameConfigTest.php @@ -81,7 +81,8 @@ public function testCnameNumberLimit() } catch (OssException $e) { $this->assertSame( $e->getMessage(), - 'num of cname in the config exceeds self::OSS_MAX_RULES: '.strval(CnameConfig::OSS_MAX_RULES)); + 'num of cname in the config exceeds self::OSS_MAX_RULES: '.strval(CnameConfig::OSS_MAX_RULES) + ); } } } diff --git a/lib/include/aliyunoss/tests/OSS/Tests/Common.php b/lib/include/aliyunoss/tests/OSS/Tests/Common.php index 8b81b599..879f0d6b 100755 --- a/lib/include/aliyunoss/tests/OSS/Tests/Common.php +++ b/lib/include/aliyunoss/tests/OSS/Tests/Common.php @@ -35,7 +35,9 @@ public static function getOssClient() $ossClient = new OssClient( getenv('OSS_ACCESS_KEY_ID'), getenv('OSS_ACCESS_KEY_SECRET'), - getenv('OSS_ENDPOINT'), false); + getenv('OSS_ENDPOINT'), + false + ); } catch (OssException $e) { printf(__FUNCTION__."creating OssClient instance: FAILED\n"); printf($e->getMessage()."\n"); diff --git a/lib/include/aliyunoss/tests/OSS/Tests/ListBucketsResultTest.php b/lib/include/aliyunoss/tests/OSS/Tests/ListBucketsResultTest.php index 83983ce0..319b8f53 100755 --- a/lib/include/aliyunoss/tests/OSS/Tests/ListBucketsResultTest.php +++ b/lib/include/aliyunoss/tests/OSS/Tests/ListBucketsResultTest.php @@ -97,7 +97,8 @@ public function test403() } catch (OssException $e) { $this->assertSame( $e->getMessage(), - 'NoSuchBucket: The specified bucket does not exist. RequestId: 1a2b-3c4d'); + 'NoSuchBucket: The specified bucket does not exist. RequestId: 1a2b-3c4d' + ); $this->assertSame($e->getHTTPStatus(), '403'); $this->assertSame($e->getRequestId(), '1a2b-3c4d'); $this->assertSame($e->getErrorCode(), 'NoSuchBucket'); diff --git a/lib/include/aliyunoss/tests/OSS/Tests/OssClientSignatureTest.php b/lib/include/aliyunoss/tests/OSS/Tests/OssClientSignatureTest.php index 3c24dc31..1b6a85a8 100755 --- a/lib/include/aliyunoss/tests/OSS/Tests/OssClientSignatureTest.php +++ b/lib/include/aliyunoss/tests/OSS/Tests/OssClientSignatureTest.php @@ -55,8 +55,11 @@ public function testGetSignedUrlForPuttingObject() $request->add_header('Content-Length', strlen($content)); $request->set_body($content); $request->send_request(); - $res = new ResponseCore($request->get_response_header(), - $request->get_response_body(), $request->get_response_code()); + $res = new ResponseCore( + $request->get_response_header(), + $request->get_response_body(), + $request->get_response_code() + ); $this->assertTrue($res->isOK()); } catch (OssException $e) { $this->assertFalse(true); @@ -78,8 +81,11 @@ public function testGetSignedUrlForPuttingObjectFromFile() $request->set_read_file($file); $request->set_read_stream_size(filesize($file)); $request->send_request(); - $res = new ResponseCore($request->get_response_header(), - $request->get_response_body(), $request->get_response_code()); + $res = new ResponseCore( + $request->get_response_header(), + $request->get_response_body(), + $request->get_response_code() + ); $this->assertTrue($res->isOK()); } catch (OssException $e) { $this->assertFalse(true); diff --git a/lib/include/aliyunoss/tests/OSS/Tests/TestOssClientBase.php b/lib/include/aliyunoss/tests/OSS/Tests/TestOssClientBase.php index 6b522f39..49a269a0 100755 --- a/lib/include/aliyunoss/tests/OSS/Tests/TestOssClientBase.php +++ b/lib/include/aliyunoss/tests/OSS/Tests/TestOssClientBase.php @@ -43,7 +43,9 @@ public function tearDown() } $objects = $this->ossClient->listObjects( - $this->bucket, ['max-keys' => 1000, 'delimiter' => ''])->getObjectList(); + $this->bucket, + ['max-keys' => 1000, 'delimiter' => ''] + )->getObjectList(); $keys = []; foreach ($objects as $obj) { $keys[] = $obj->getKey(); diff --git a/lib/include/sphinxapi.php b/lib/include/sphinxapi.php index 08cd91aa..719ff178 100755 --- a/lib/include/sphinxapi.php +++ b/lib/include/sphinxapi.php @@ -699,8 +699,13 @@ public function _GetResponse($fp, $client_ver) // check version if ($ver < $client_ver) { - $this->_warning = sprintf("searchd command v.%d.%d older than client's v.%d.%d, some options might not work", - $ver >> 8, $ver & 0xff, $client_ver >> 8, $client_ver & 0xff); + $this->_warning = sprintf( + "searchd command v.%d.%d older than client's v.%d.%d, some options might not work", + $ver >> 8, + $ver & 0xff, + $client_ver >> 8, + $client_ver & 0xff + ); } return $response; @@ -771,7 +776,8 @@ public function SetSortMode($mode, $sortby = '') SPH_SORT_ATTR_ASC == $mode || SPH_SORT_TIME_SEGMENTS == $mode || SPH_SORT_EXTENDED == $mode || - SPH_SORT_EXPR == $mode); + SPH_SORT_EXPR == $mode + ); assert(is_string($sortby)); assert(SPH_SORT_RELEVANCE == $mode || strlen($sortby) > 0); @@ -1223,8 +1229,10 @@ public function _ParseSearchResponse($response, $nreqs) list(, $weight) = unpack('N*', substr($response, $p, 4)); $p += 4; } else { - list($doc, $weight) = array_values(unpack('N*N*', - substr($response, $p, 8))); + list($doc, $weight) = array_values(unpack( + 'N*N*', + substr($response, $p, 8) + )); $p += 8; $doc = sphFixUint($doc); }