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

michalsn / codeigniter-htmx / 13707691824

06 Mar 2025 08:36PM UTC coverage: 74.783%. First build
13707691824

Pull #83

github

web-flow
Merge 7f79fbae7 into 2ec7f6426
Pull Request #83: chore: update workflow to support PHP 8.4

17 of 22 new or added lines in 6 files covered. (77.27%)

258 of 345 relevant lines covered (74.78%)

7.91 hits per line

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

100.0
/src/View/ErrorModalDecorator.php
1
<?php
2

3
namespace Michalsn\CodeIgniterHtmx\View;
4

5
use CodeIgniter\View\ViewDecoratorInterface;
6

7
class ErrorModalDecorator implements ViewDecoratorInterface
8
{
9
    public static function decorate(string $html): string
10
    {
11
        if (CI_DEBUG
29✔
12
            && (! is_cli() || ENVIRONMENT === 'testing')
29✔
13
            && ! service('request')->isHtmx()
29✔
14
            && config('Htmx')->errorModalDecorator
29✔
15
            && str_contains($html, '</head>')
29✔
16
            && ! str_contains($html, config('Htmx')->skipViewDecoratorsString)
29✔
17
            && ! str_contains($html, 'id="htmxErrorModalScript"')
29✔
18
        ) {
19
            $script = sprintf(
3✔
20
                '<script %s id="htmxErrorModalScript">%s</script>',
3✔
21
                csp_script_nonce(),
3✔
22
                file_get_contents(__DIR__ . '/error_modal_decorator.js'),
3✔
23
            );
3✔
24

25
            $html = preg_replace(
3✔
26
                '/<\/head>/',
3✔
27
                $script . '</head>',
3✔
28
                $html,
3✔
29
                1,
3✔
30
            );
3✔
31
        }
32

33
        return $html;
29✔
34
    }
35
}
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