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

IlyasDeckers / ody-core / 13532154862

25 Feb 2025 10:24PM UTC coverage: 30.374% (+1.7%) from 28.706%
13532154862

push

github

web-flow
Update php.yml

544 of 1791 relevant lines covered (30.37%)

9.13 hits per line

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

0.0
/src/Error/Renderers/PlainTextErrorRenderer.php
1
<?php
2
declare(strict_types=1);
3

4
namespace Ody\Core\Error\Renderers;
5

6
use Ody\Core\Error\AbstractErrorRenderer;
7
use Throwable;
8

9
use function get_class;
10
use function htmlentities;
11
use function sprintf;
12

13
/**
14
 * Default application Plain Text Error Renderer
15
 */
16
class PlainTextErrorRenderer extends AbstractErrorRenderer
17
{
18
    public function __invoke(Throwable $exception, bool $displayErrorDetails): string
×
19
    {
20
        $text = "{$this->getErrorTitle($exception)}\n";
×
21

22
        if ($displayErrorDetails) {
×
23
            $text .= $this->formatExceptionFragment($exception);
×
24

25
            while ($exception = $exception->getPrevious()) {
×
26
                $text .= "\nPrevious Error:\n";
×
27
                $text .= $this->formatExceptionFragment($exception);
×
28
            }
29
        }
30

31
        return $text;
×
32
    }
33

34
    private function formatExceptionFragment(Throwable $exception): string
×
35
    {
36
        $text = sprintf("Type: %s\n", get_class($exception));
×
37

38
        $code = $exception->getCode();
×
39

40
        $text .= sprintf("Code: %s\n", $code);
×
41

42
        $text .= sprintf("Message: %s\n", $exception->getMessage());
×
43

44
        $text .= sprintf("File: %s\n", $exception->getFile());
×
45

46
        $text .= sprintf("Line: %s\n", $exception->getLine());
×
47

48
        $text .= sprintf('Trace: %s', $exception->getTraceAsString());
×
49

50
        return $text;
×
51
    }
52
}
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