Skip to content

Commit

Permalink
Merge pull request #14 from oiuv/analysis-e7NoDK
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
oiuv authored Mar 29, 2020
2 parents b91b4a1 + 7474294 commit a7df340
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 25 deletions.
2 changes: 1 addition & 1 deletion lib/ftp.cls.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
6 changes: 4 additions & 2 deletions lib/include/aliyunoss/samples/LiveChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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, ]
);
Expand Down
14 changes: 10 additions & 4 deletions lib/include/aliyunoss/samples/Signature.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 4 additions & 2 deletions lib/include/aliyunoss/src/OSS/Result/ListBucketsResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
15 changes: 12 additions & 3 deletions lib/include/aliyunoss/src/OSS/Result/ListMultipartUploadResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}
}
3 changes: 2 additions & 1 deletion lib/include/aliyunoss/tests/OSS/Tests/CnameConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
}
}
}
4 changes: 3 additions & 1 deletion lib/include/aliyunoss/tests/OSS/Tests/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
14 changes: 10 additions & 4 deletions lib/include/aliyunoss/tests/OSS/Tests/OssClientSignatureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion lib/include/aliyunoss/tests/OSS/Tests/TestOssClientBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
18 changes: 13 additions & 5 deletions lib/include/sphinxapi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit a7df340

Please sign in to comment.