Skip to content

Commit

Permalink
optimize: 使用 is_file 代替字符串结尾判断 (#982)
Browse files Browse the repository at this point in the history
* 使用 is_file 代替字符串结尾判断

* update changelog

---------

Co-authored-by: yansongda <me@yansongda.cn>
  • Loading branch information
NotMings and yansongda committed May 16, 2024
1 parent 747806e commit a57a52f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v3.7.4

### optimized

- optimize: 使用 is_file 代替字符串结尾判断(#982)

## v3.7.3

### fixed
Expand Down
5 changes: 2 additions & 3 deletions src/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
use Yansongda\Pay\Provider\Unipay;
use Yansongda\Pay\Provider\Wechat;
use Yansongda\Supports\Collection;
use Yansongda\Supports\Str;

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

function get_public_cert(string $key): string
{
return Str::endsWith($key, ['.cer', '.crt', '.pem']) ? file_get_contents($key) : $key;
return is_file($key) ? file_get_contents($key) : $key;
}

function get_private_cert(string $key): string
{
if (Str::endsWith($key, ['.crt', '.pem'])) {
if (is_file($key)) {
return file_get_contents($key);
}

Expand Down

0 comments on commit a57a52f

Please sign in to comment.