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

miaoxing / services / 4708147404

pending completion
4708147404

push

github

twinh
feat(Http): `toRet` 方法支持返回值不是数组

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

2 existing lines in 1 file now uncovered.

61 of 616 relevant lines covered (9.9%)

5.75 hits per line

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

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

3
namespace Miaoxing\Services\Service;
4

5
use Wei\Ret;
6
use Wei\RetTrait;
7

8
class Http extends \Wei\Http
9
{
10
    use RetTrait;
11

12
    /**
13
     * 返回 ret 格式的 HTTP 请求结果
14
     *
15
     * @param array $data
16
     * @return Ret
17
     */
18
    public function toRet(array $data = [])
19
    {
20
        if ($this->isSuccess()) {
×
NEW
21
            $response = $this->getResponse();
×
NEW
22
            $extra = is_array($response) ? $response : ['data' => $response];
×
NEW
23
            return $this->suc($data + $extra);
×
24
        }
25

UNCOV
26
        $e = $this->getErrorException();
×
UNCOV
27
        return $this->err($data + ['code' => $e->getCode(), 'message' => $e->getMessage()]);
×
28
    }
29
}
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

© 2025 Coveralls, Inc