Skip to content

Commit a57a52f

Browse files
NotMingsyansongda
andauthored
optimize: 使用 is_file 代替字符串结尾判断 (#982)
* 使用 is_file 代替字符串结尾判断 * update changelog --------- Co-authored-by: yansongda <[email protected]>
1 parent 747806e commit a57a52f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## v3.7.4
2+
3+
### optimized
4+
5+
- optimize: 使用 is_file 代替字符串结尾判断(#982)
6+
17
## v3.7.3
28

39
### fixed

src/Functions.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
use Yansongda\Pay\Provider\Unipay;
2626
use Yansongda\Pay\Provider\Wechat;
2727
use Yansongda\Supports\Collection;
28-
use Yansongda\Supports\Str;
2928

3029
use function Yansongda\Artful\get_radar_body;
3130
use function Yansongda\Artful\get_radar_method;
@@ -37,12 +36,12 @@ function get_tenant(array $params = []): string
3736

3837
function get_public_cert(string $key): string
3938
{
40-
return Str::endsWith($key, ['.cer', '.crt', '.pem']) ? file_get_contents($key) : $key;
39+
return is_file($key) ? file_get_contents($key) : $key;
4140
}
4241

4342
function get_private_cert(string $key): string
4443
{
45-
if (Str::endsWith($key, ['.crt', '.pem'])) {
44+
if (is_file($key)) {
4645
return file_get_contents($key);
4746
}
4847

0 commit comments

Comments
 (0)