• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

miaoxing / logistics / 7241272451

03 Dec 2023 08:18AM UTC coverage: 35.839%. Remained the same
7241272451

push

github

twinh
refactor(logistic): 更新 Http 调用,解决 phpstan 报错

Error: Cannot unset offset 'data' on array{traces: mixed}.
Line   src/Service/Kuaidi100.php
37     Cannot unset offset 'data' on array{traces: mixed}.

24 of 104 branches covered (0.0%)

0 of 1 new or added line in 1 file covered. (0.0%)

205 of 572 relevant lines covered (35.84%)

3.58 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Service/Kuaidi100.php
1
<?php
2

3
namespace Miaoxing\Logistics\Service;
4

5
use Miaoxing\App\Service\Logger;
6
use Miaoxing\Plugin\BaseService;
7
use Wei\Http;
8
use Wei\RetTrait;
9

10
/**
11
 * @property Logger $logger
12
 */
13
class Kuaidi100 extends BaseService
14
{
15
    use RetTrait;
16

17
    public function getTraces($name, $code)
18
    {
NEW
19
        $http = Http::get([
×
20
            'url' => sprintf('https://www.kuaidi100.com/query?type=%s&postid=%s&id=1&valicode=&temp=', $name, $code),
×
21
            'userAgent' => implode(' ', [
×
22
                'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N)',
×
23
                'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Mobile Safari/537.36',
24
            ]),
25
            'referer' => true,
26
            'dataType' => 'json',
×
27
            'throwException' => false,
28
        ]);
29

30
        if (!isset($http['message']) || 'ok' !== $http['message']) {
×
31
            $message = isset($http['message']) ? $http['message'] : '请求失败';
×
32
            $ret = $http->toRet($this->err($message));
×
33
            $this->logger->warning('快递查询失败', $ret);
×
34
            return $ret;
×
35
        }
36

37
        $http['traces'] = $http['data'];
×
38
        unset($http['data']);
×
39
        return $http->toRet($this->suc());
×
40
    }
41
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc