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

nette / latte / 22359082277

24 Feb 2026 04:03PM UTC coverage: 93.959% (+0.05%) from 93.907%
22359082277

push

github

dg
fixed operator ! priority

5273 of 5612 relevant lines covered (93.96%)

0.94 hits per line

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

93.33
/src/Latte/PositionAwareException.php
1
<?php declare(strict_types=1);
2

3
/**
4
 * This file is part of the Latte (https://latte.nette.org)
5
 * Copyright (c) 2008 David Grudl (https://davidgrudl.com)
6
 */
7

8
namespace Latte;
9

10
use Latte\Compiler\Position;
11

12

13
/** @internal */
14
trait PositionAwareException
15
{
16
        public ?string $sourceCode = null;
17
        public ?string $sourceName = null;
18
        public ?Position $position = null;
19
        private string $origMessage;
20

21

22
        public function setSource(string $code, ?string $name = null): self
1✔
23
        {
24
                $this->sourceCode = $code;
1✔
25
                $this->sourceName = $name;
1✔
26
                $this->generateMessage();
1✔
27
                return $this;
1✔
28
        }
29

30

31
        private function generateMessage(): void
32
        {
33
                $this->origMessage ??= $this->message;
1✔
34
                $info = [];
1✔
35
                if ($this->sourceName && @is_file($this->sourceName)) { // @ - may trigger error
1✔
36
                        $info[] = "in '" . str_replace(dirname($this->sourceName, 2), '...', $this->sourceName) . "'";
×
37
                }
38
                if ($this->position) {
1✔
39
                        $info[] = $this->position;
1✔
40
                }
41
                $this->message = $info
1✔
42
                        ? rtrim($this->origMessage, '.') . ' (' . implode(' ', $info) . ')'
1✔
43
                        : $this->origMessage;
1✔
44
        }
1✔
45
}
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