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

dg / texy / 22262381750

25 Jan 2026 11:44PM UTC coverage: 92.367% (-0.7%) from 93.057%
22262381750

push

github

dg
cs

9 of 11 new or added lines in 8 files covered. (81.82%)

161 existing lines in 23 files now uncovered.

2384 of 2581 relevant lines covered (92.37%)

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, 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 array<int, 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
        /** @return mixed */
39
        public function proceed(...$args)
1✔
40
        {
41
                if ($this->pos === 0) {
1✔
UNCOV
42
                        throw new \RuntimeException('No more handlers.');
×
43
                }
44

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

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

56
                return $res;
1✔
57
        }
58

59

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

65

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