<commit_before><?php

namespace Zhiyi\Plus\Services;

use JPush\Client;
use Illuminate\Contracts\Config\Repository;

class Push
{
    // 推送环境
    protected $environment;

    // 推送实例
    protected $client;

    public function __construct(Repository $config)
    {
        $appkey = $config->get('jpush.app_key');
        $secret = $config->get('jpush.master_secret');

        $this->environment = $config->get('jpush.environment', false);

        if (! $appkey || ! $secret) {
            return false;
        }

        $this->client = new Client($appkey, $secret);
    }

    public function push($alert, $audience, $extras = [])
    {
        $notification = [
            'extras' => $extras,
        ];

        if ($audience == 'all') {
            return $this->pushAll($this->client, $alert, $notification);
        }
<commit_msg>优化推送读取配置为空时的返回<commit_after><?php

namespace Zhiyi\Plus\Services;

use JPush\Client;
use Illuminate\Contracts\Config\Repository;

class Push
{
    // 推送环境
    protected $environment;

    protected $appkey;

    protected $secret;

    public function __construct(Repository $config)
    {
        $this->appkey = $config->get('jpush.app_key');
        $this->secret = $config->get('jpush.master_secret');

        $this->environment = $config->get('jpush.environment', false);
    }

    public function push($alert, $audience, $extras = [])
    {
        if (! $this->appkey || ! $this->secret) {
            return false;
        }

        $client = new Client($this->appkey, $this->secret);

        $notification = [
            'extras' => $extras,
        ];

        if ($audience == 'all') {
            return $this->pushAll($this->client, $alert, $notification);
        }

{'fraction_non_alphanumeric': 0.15518239722061378, 'fraction_numerical': 0.0, 'mean_word_length': 2.3423597678916828, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1418743', 'n_tokens_mistral': 554, 'n_tokens_neox': 554, 'n_words': 101}