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

dg / texy / 20980727294

14 Jan 2026 03:00AM UTC coverage: 92.376%. Remained the same
20980727294

push

github

dg
added CLAUDE.md

2387 of 2584 relevant lines covered (92.38%)

0.92 hits per line

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

77.78
/src/Texy/HandlerInvocation.php
1
<?php
2

3
/**
4
 * This file is part of the Texy! (https://texy.nette.org)
5
 * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6
 */
7

8
declare(strict_types=1);
9

10
namespace Texy;
11

12
use function array_unshift, count, get_class, is_string;
13

14

15
/**
16
 * Around advice handlers.
17
 */
18
final class HandlerInvocation
19
{
20
        private int $pos;
21

22
        /** @var mixed[] */
23
        private array $args;
24

25

26
        public function __construct(
1✔
27
                /** @var list<callable> */
28
                private array $handlers,
29
                private readonly Parser $parser,
30
                array $args,
31
        ) {
32
                $this->pos = count($this->handlers);
1✔
33
                array_unshift($args, $this);
1✔
34
                $this->args = $args;
1✔
35
        }
1✔
36

37

38
        public function proceed(...$args): string|HtmlElement|null
1✔
39
        {
40
                if ($this->pos === 0) {
1✔
41
                        throw new \RuntimeException('No more handlers.');
×
42
                }
43

44
                if ($args) {
1✔
45
                        $this->args = $args;
×
46
                        array_unshift($this->args, $this);
×
47
                }
48

49
                $this->pos--;
1✔
50
                $res = $this->handlers[$this->pos](...$this->args);
1✔
51
                if ($res !== null && !is_string($res) && !$res instanceof HtmlElement) {
1✔
52
                        throw new \UnexpectedValueException("Invalid value returned from handler '" . $this->handlers[$this->pos][0]::class . "'.");
×
53
                }
54

55
                return $res;
1✔
56
        }
57

58

59
        public function getParser(): Parser
60
        {
61
                return $this->parser;
1✔
62
        }
63

64

65
        public function getTexy(): Texy
66
        {
67
                return $this->parser->getTexy();
1✔
68
        }
69
}
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