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

NIT-Administrative-Systems / dynamic-forms / 13506106128

24 Feb 2025 07:22PM UTC coverage: 59.275% (-34.7%) from 94.003%
13506106128

Pull #480

github

nie7321
Additional annotations
Pull Request #480: Laravel 12

818 of 1380 relevant lines covered (59.28%)

44.49 hits per line

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

0.0
/src/JSONLogic/LodashFunctions/Util.php
1
<?php
2

3
namespace Northwestern\SysDev\DynamicForms\JSONLogic\LodashFunctions;
4

5
use Closure;
6

7
trait Util
8
{
9
    public static function constant(mixed $value): Closure
10
    {
11
        return function () use ($value) {
×
12
            return $value;
×
13
        };
×
14
    }
15

16
    public static function iteratee(mixed $value = null): callable
17
    {
18
        return \_\internal\baseIteratee($value);
×
19
    }
20

21
    public static function matches(array $source): Closure
22
    {
23
        return function ($object) use ($source) {
×
24
            foreach ($source as $key => $value) {
×
25
                if (! (array_key_exists($key, $object) && $object[$key] == $value)) {
×
26
                    return false;
×
27
                }
28
            }
29

30
            return true;
×
31
        };
×
32
    }
33

34
    public static function matchesProperty(array | string $path, mixed $srcValue): Closure
35
    {
36
        return function ($object) use ($srcValue, $path) {
×
37
            if (array_key_exists($path, $object) && $object[$path] == $srcValue) {
×
38
                return true;
×
39
            }
40

41
            return false;
×
42
        };
×
43
    }
44

45
    public static function range(int $start = null, int $stop = null, int $step = 1): array
46
    {
47
        if ($stop == null && $start != null) {
×
48
            $stop = $start;
×
49
            $start = 0;
×
50
        }
51
        if ($step == 0) {
×
52
            return array_pad([], $stop - $start, $start);
×
53
        }
54
        $ret = range($start, $stop, $step);
×
55
        if (($stop - $start) % $step == 0) {
×
56
            array_pop($ret);
×
57
        }
58

59
        return $ret;
×
60
    }
61

62
    public static function rangeRight(int $start = null, int $stop = null, int $step = 1): array
63
    {
64
        return array_reverse(self::range($start, $stop, $step));
×
65
    }
66

67
    public static function stubArray(): array
68
    {
69
        return [];
×
70
    }
71

72
    public static function stubFalse(): bool
73
    {
74
        return false;
×
75
    }
76

77
    public static function stubObject(): array
78
    {
79
        //must be array because stdClass is not used, it is all assoc arrays
80
        return [];
×
81
    }
82

83
    public static function stubString(): string
84
    {
85
        return '';
×
86
    }
87

88
    public static function stubTrue(): bool
89
    {
90
        return true;
×
91
    }
92

93
    public static function toPath(string $value): array
94
    {
95
        $value = str_replace('[', '.', $value);
×
96
        $value = str_replace(']', '', $value);
×
97

98
        return explode('.', $value);
×
99
    }
100

101
    public static function times(int $n, callable $iteratee): array
102
    {
103
        $ret = [];
×
104
        for ($i = 0; $i < $n; $i++) {
×
105
            $ret[] = $iteratee();
×
106
        }
107

108
        return $ret;
×
109
    }
110
}
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