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

dg / texy / 16790351274

06 Aug 2025 10:42PM UTC coverage: 92.746% (+0.005%) from 92.741%
16790351274

push

github

dg
HtmlElement: removed toHtml() & toText()

18 of 19 new or added lines in 5 files covered. (94.74%)

136 existing lines in 23 files now uncovered.

2391 of 2578 relevant lines covered (92.75%)

0.93 hits per line

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

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

3
/**
4
 * This file is part of the Texy! (https://texy.info)
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
        /** @var array<int, callable> */
21
        private array $handlers;
22
        private int $pos;
23
        private array $args;
24
        private Parser $parser;
25

26

27
        public function __construct(array $handlers, Parser $parser, array $args)
1✔
28
        {
29
                $this->handlers = $handlers;
1✔
30
                $this->pos = count($handlers);
1✔
31
                $this->parser = $parser;
1✔
32
                array_unshift($args, $this);
1✔
33
                $this->args = $args;
1✔
34
        }
1✔
35

36

37
        /** @return mixed */
38
        public function proceed(...$args)
1✔
39
        {
40
                if ($this->pos === 0) {
1✔
UNCOV
41
                        throw new Exception('No more handlers.');
×
42
                }
43

44
                if ($args) {
1✔
UNCOV
45
                        $this->args = $args;
×
UNCOV
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✔
UNCOV
52
                        throw new Exception("Invalid value returned from handler '" . get_class($this->handlers[$this->pos][0]) . "'.");
×
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