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

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

5
trait Objects
6
{
7
    public static function at(array $object, string | array $paths): array
8
    {
9
        $ret = [];
×
10
        foreach ($paths as $path) {
×
11
            $ret[] = \_\get($object, $path);
×
12
        }
13

14
        return $ret;
×
15
    }
16

17
    public static function entries(array $object): array
18
    {
19
        $ret = [];
×
20
        foreach ($object as $key => $item) {
×
21
            $ret[] = [$key, $item];
×
22
        }
23

24
        return $ret;
×
25
    }
26

27
    public static function entriesIn(array $object): array
28
    {
29
        //This is the same as entries since we do not support inherited properties for objects
30
        return self::entries($object);
×
31
    }
32

33
    //This is an alias of entries
34
    public static function toPairs(array $object): array
35
    {
36
        return self::entries($object);
×
37
    }
38

39
    //This is an alias of entriesIn
40
    public static function toPairsIn(array $object): array
41
    {
42
        return self::entries($object);
×
43
    }
44

45
    public static function hasIn(array $object, string | array $path): bool
46
    {
47
        //This is the same as has since we do not support inherited properties for objects
48
        return self::has($object, $path);
×
49
    }
50

51
    public static function invert(array $object): array
52
    {
53
        return array_flip($object);
×
54
    }
55

56
    public static function keys(array | string $object): array
57
    {
58
        if (self::isObject($object)) { //even if it is a js object it will be passed as an associative array
×
59
            $ret = [];
×
60
            foreach ($object as $key => $item) {
×
61
                $ret[] = $key;
×
62
            }
63

64
            return $ret;
×
65
        }
66
        if (is_string($object)) {
×
67
            return array_map('strval', range(0, strlen($object) - 1));
×
68
        }
69

70
        return [];
×
71
    }
72

73
    public static function keysIn(array | string $object): array
74
    {
75
        //This is the same as keys since we do not support inherited properties for objects
76
        return self::keys($object);
×
77
    }
78

79
    public static function omit(array $object, array $paths): array
80
    {
81
        $picked = self::pick($object, $paths);
×
82
        $ret = [];
×
83
        foreach ($object as $key => &$item) {
×
84
            if (! array_key_exists($key, $picked)) {
×
85
                $ret[$key] = $item;
×
86
            }
87
        }
88

89
        return $ret;
×
90
    }
91

92
    public static function result(array $object, array | string $path, mixed $defaultValue = null): mixed
93
    {
94
        //This is the same as get since we do not support functions within objects
95
        return \_\get($object, $path, $defaultValue);
×
96
    }
97

98
    public static function values(array | string $object): array
99
    {
100
        if (self::isObject($object)) {
×
101
            $ret = [];
×
102
            foreach ($object as $key => $item) {
×
103
                $ret[] = $item;
×
104
            }
105

106
            return $ret;
×
107
        }
108
        if (is_string($object)) {
×
109
            return str_split($object);
×
110
        }
111

112
        return [];
×
113
    }
114

115
    public static function valuesIn(array | string $object): array
116
    {
117
        //This is the same as values since we do not support inherited properties for objects
118
        return self::values($object);
×
119
    }
120

121
    public static function isNull(mixed $value): bool
122
    {
123
        return is_null($value);
×
124
    }
125

126
    public static function isArray(mixed $value): bool
127
    {
128
        return is_array($value);
×
129
    }
130

131
    public static function isString(mixed $value): bool
132
    {
133
        return is_string($value);
×
134
    }
135
}
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