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

tochka-developers / jsonrpc / 4135501466

pending completion
4135501466

push

github

darkdarin
Merge remote-tracking branch 'origin/v5.0'

209 of 813 new or added lines in 51 files covered. (25.71%)

233 of 1307 relevant lines covered (17.83%)

1.84 hits per line

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

0.0
/src/Exceptions/Errors/HttpExceptionError.php
1
<?php
2

3
namespace Tochka\JsonRpc\Exceptions\Errors;
4

5
use Illuminate\Http\Response;
6
use Symfony\Component\HttpKernel\Exception\HttpException;
7
use Tochka\JsonRpc\Standard\Exceptions\Errors\InternalError;
8

9
class HttpExceptionError extends InternalError
10
{
11
    private HttpException $exception;
12

13
    public function __construct(HttpException $exception)
14
    {
NEW
15
        $this->exception = $exception;
×
16

NEW
17
        parent::__construct($exception);
×
18
    }
19

20
    public function toArray(): array
21
    {
NEW
22
        if (!empty($this->exception->getMessage())) {
×
NEW
23
            $message = $this->exception->getMessage();
×
24
        } else {
25
            /** @var string $message */
NEW
26
            $message = array_key_exists($this->exception->getStatusCode(), Response::$statusTexts)
×
NEW
27
                ? Response::$statusTexts[$this->exception->getStatusCode()]
×
NEW
28
                : 'Unknown error';
×
29
        }
30

NEW
31
        return [
×
NEW
32
            'exception' => [
×
NEW
33
                'name' => $this->exception::class,
×
NEW
34
                'code' => $this->exception->getCode(),
×
NEW
35
                'message' => $message,
×
NEW
36
            ]
×
NEW
37
        ];
×
38
    }
39
}
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