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

michalsn / codeigniter-htmx / 3595767781

pending completion
3595767781

push

github

michalsn
cs-fix

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

138 of 148 relevant lines covered (93.24%)

5.04 hits per line

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

0.0
/src/Common.php
1
<?php
2

3
use CodeIgniter\Config\View;
4
use Michalsn\CodeIgniterHtmx\Config\Services;
5

6
if (! function_exists('view_fragment')) {
7
    /**
8
     * Grabs the current RendererInterface-compatible class
9
     * and tells it to render the specified view fragments.
10
     * Simply provides a convenience method that can be used
11
     * in Controllers, libraries, and routed closures.
12
     *
13
     * NOTE: Does not provide any escaping of the data, so that must
14
     * all be handled manually by the developer.
15
     *
16
     * @param array $options Options for saveData or third-party extensions.
17
     */
18
    function view_fragment(string $name, string|array $fragments, array $data = [], array $options = []): string
19
    {
20
        $renderer = Services::renderer();
×
21

22
        /** @var View $config */
NEW
23
        $config   = config(View::class);
×
24
        $saveData = $config->saveData;
×
25

26
        if (array_key_exists('saveData', $options)) {
×
NEW
27
            $saveData = (bool) $options['saveData'];
×
28
            unset($options['saveData']);
×
29
        }
30

31
        $options['fragments'] = is_string($fragments)
×
32
            ? array_map('trim', explode(',', $fragments))
×
33
            : $fragments;
×
34

35
        return $renderer->setData($data, 'raw')->render($name, $options, $saveData);
×
36
    }
37
}
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