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

basis-company / nats.php / 13656319620

04 Mar 2025 02:48PM UTC coverage: 94.859% (+0.2%) from 94.708%
13656319620

push

github

web-flow
added ability to set consumer inactive threshold parameter (#104)

* add setting for consumer params in nats

* fix error in testServiceRunner

* add test for consumer inactive thresold

* define ConsumerLimits public

20 of 23 new or added lines in 3 files covered. (86.96%)

1384 of 1459 relevant lines covered (94.86%)

17.73 hits per line

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

72.73
/src/Stream/ConsumerLimits.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Basis\Nats\Stream;
6

7
use DomainException;
8

9
final class ConsumerLimits
10
{
11
    public const MAX_ACK_PENDING = 'max_ack_pending';
12
    public const INACTIVE_THRESHOLD = 'inactive_threshold';
13

14

15
    public static function validate(array $limits): array
1✔
16
    {
17
        foreach ($limits as $param => $value) {
1✔
18
            if (!self::paramIsValid($param, $value)) {
1✔
NEW
19
                throw new DomainException("Invalid param: $param");
×
20
            }
21
        }
22

23
        return $limits;
1✔
24
    }
25

26
    private static function paramIsValid(string $param, $value): bool
1✔
27
    {
28

29
        if ($param === self::MAX_ACK_PENDING) {
1✔
NEW
30
            return is_int($value);
×
31
        }
32

33
        if ($param === self::INACTIVE_THRESHOLD) {
1✔
34
            return is_int($value);
1✔
35
        }
36

NEW
37
        return true;
×
38
    }
39

40
}
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