• 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/HTTP/HtmxTrait.php
1
<?php
2

3
namespace Michalsn\CodeIgniterHtmx\HTTP;
4

5
use InvalidArgumentException;
6

7
trait HtmxTrait
8
{
9
    private array $swapOptions = [
10
        'innerHTML',
11
        'outerHTML',
12
        'beforebegin',
13
        'afterbegin',
14
        'beforeend',
15
        'afterend',
16
        'delete',
17
        'none',
18
    ];
19

20
    /**
21
     * Validate swap option
22
     */
23
    private function validateSwap(string $option, string $field = 'swap'): bool
24
    {
25
        [$option] = explode(' ', $option, 2);
5✔
26

27
        if (! in_array($option, $this->swapOptions, true)) {
5✔
28
            throw new InvalidArgumentException(sprintf(
2✔
29
                'Option "%s" is not a valid variable for %s. A valid option has to be one of: %s',
2✔
30
                $option,
2✔
31
                $field,
2✔
32
                implode(', ', $this->swapOptions),
2✔
33
            ));
2✔
34
        }
35

36
        return true;
3✔
37
    }
38
}
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