Skip to content

Commit

Permalink
使用 is_file 代替字符串结尾判断
Browse files Browse the repository at this point in the history
  • Loading branch information
NotMings committed May 16, 2024
1 parent 747806e commit 1546622
Showing 1 changed file with 2 additions and 3 deletions.
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 1546622

Please sign in to comment.