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

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

5
trait Lang
6
{
7
    public static function castArray(mixed $value = null): array
8
    {
9
        if (func_num_args() == 0) {
×
10
            return [];
×
11
        }
12
        if (is_array($value)) {
×
13
            if ($value !== array_values($value)) {
×
14
                return [$value];
×
15
            }
16

17
            return $value;
×
18
        }
19

20
        return [$value];
×
21
    }
22

23
    public static function gt(mixed $value, mixed $other): bool
24
    {
25
        return $value > $other;
×
26
    }
27

28
    public static function gte(mixed $value, mixed $other): bool
29
    {
30
        return $value >= $other;
×
31
    }
32

33
    public static function lt(mixed $value, mixed $other): bool
34
    {
35
        return $value < $other;
×
36
    }
37

38
    public static function lte(mixed $value, mixed $other): bool
39
    {
40
        return $value <= $other;
×
41
    }
42

43
    public static function isArrayLike(mixed $value): bool
44
    {
45
        return is_array($value) || is_string($value);
×
46
    }
47

48
    public static function isArrayLikeObject(mixed $value): bool
49
    {
50
        return is_array($value);
×
51
    }
52

53
    public static function isBoolean(mixed $value): bool
54
    {
55
        return is_bool($value);
×
56
    }
57

58
    public static function isFinite(mixed $value): bool
59
    {
60
        return is_float($value) || is_int($value);
×
61
    }
62

63
    public static function isInteger(mixed $value): bool
64
    {
65
        return is_int($value);
×
66
    }
67

68
    public static function isLength(mixed $value): bool
69
    {
70
        return is_int($value);
×
71
    }
72

73
    public static function isMatch(array $object, array $source): bool
74
    {
75
        foreach ($source as $key => $value) {
×
76
            if (! (array_key_exists($key, $object) && $object[$key] == $value)) {
×
77
                return false;
×
78
            }
79
        }
80

81
        return true;
×
82
    }
83

84
    public static function isNan(mixed $value): bool
85
    {
86
        return is_float($value) && is_nan($value);
×
87
    }
88

89
    public static function isNumber(mixed $value): bool
90
    {
91
        return is_int($value) || is_float($value);
×
92
    }
93

94
    public static function isObject(mixed $value): bool
95
    {
96
        return is_object($value) || is_array($value);
×
97
    }
98

99
    public static function isObjectStrict(mixed $value): bool
100
    {
101
        return is_object($value);
×
102
    }
103

104
    public static function toArray(mixed $value): array
105
    {
106
        if (self::isObject($value)) { //even if it is a js object it will be passed as an associative array
×
107
            $ret = [];
×
108
            foreach ($value as $key => $item) {
×
109
                $ret[] = $item;
×
110
            }
111

112
            return $ret;
×
113
        }
114
        if (is_string($value)) {
×
115
            return str_split($value);
×
116
        }
117

118
        return [];
×
119
    }
120

121
    public static function toFinite(mixed $value): float
122
    {
123
        return floatval($value);
×
124
    }
125

126
    public static function toInteger(mixed $value): int
127
    {
128
        return intval($value);
×
129
    }
130

131
    public static function toLength(mixed $value): int
132
    {
133
        return intval($value) < 0 ? 0 : intval($value);
×
134
    }
135

136
    public static function toNumber(mixed $value): float
137
    {
138
        return floatval($value);
×
139
    }
140

141
    public static function toSafeInteger(mixed $value): bool
142
    {
143
        return intval($value);
×
144
    }
145

146
    public static function toString(mixed $value): string
147
    {
148
        if (is_array($value)) {
×
149
            $ret = '';
×
150
            foreach ($value as $subpart) {
×
151
                $ret .= strval($subpart).',';
×
152
            }
153
            $temp = rtrim($ret, ',');
×
154

155
            return $temp;
×
156
        }
157

158
        return strval($value);
×
159
    }
160
}
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