Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading