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

tempestphp / tempest-framework / 14322727335

07 Apr 2025 03:10PM UTC coverage: 81.259% (+0.4%) from 80.906%
14322727335

push

github

web-flow
fix(support): non-dev bun dependencies installation (#1124)

0 of 12 new or added lines in 1 file covered. (0.0%)

25 existing lines in 6 files now uncovered.

11434 of 14071 relevant lines covered (81.26%)

105.02 hits per line

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

89.66
/src/Tempest/View/src/Elements/GenericElement.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Tempest\View\Elements;
6

7
use Tempest\View\Element;
8

9
use function Tempest\Support\Html\is_void_tag;
10
use function Tempest\Support\str;
11

12
final class GenericElement implements Element
13
{
14
    use IsElement;
15

16
    public function __construct(
102✔
17
        private readonly string $tag,
18
        array $attributes,
19
    ) {
20
        $this->attributes = $attributes;
102✔
21
    }
22

UNCOV
23
    public function getTag(): string
×
24
    {
UNCOV
25
        return $this->tag;
×
26
    }
27

28
    public function compile(): string
96✔
29
    {
30
        $content = [];
96✔
31

32
        foreach ($this->getChildren() as $child) {
96✔
33
            $content[] = $child->compile();
71✔
34
        }
35

36
        $content = implode('', $content);
96✔
37

38
        $attributes = [];
96✔
39

40
        foreach ($this->getAttributes() as $name => $value) {
96✔
41
            $name = str($name);
43✔
42

43
            if ($name->startsWith(':')) {
43✔
UNCOV
44
                $name = ':' . $name->kebab()->toString();
×
45
            } else {
46
                $name = $name->kebab()->toString();
43✔
47
            }
48

49
            if ($value) {
43✔
50
                $attributes[] = $name . '="' . $value . '"';
43✔
51
            } else {
52
                $attributes[] = $name;
2✔
53
            }
54
        }
55

56
        $attributes = implode(' ', [...$attributes, ...$this->rawAttributes]);
96✔
57

58
        if ($attributes !== '') {
96✔
59
            $attributes = ' ' . $attributes;
59✔
60
            $attributes = str_replace(
59✔
61
                ['?> <?php', '?> <?='],
59✔
62
                ['?><?php', '?><?='],
59✔
63
                $attributes,
59✔
64
            );
59✔
65
        }
66

67
        // Void elements
68
        if (is_void_tag($this->tag)) {
96✔
69
            return "<{$this->tag}{$attributes}>";
8✔
70
        }
71

72
        return "<{$this->tag}{$attributes}>{$content}</{$this->tag}>";
96✔
73
    }
74
}
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

© 2025 Coveralls, Inc