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

NIT-Administrative-Systems / dynamic-forms / 13506324421

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

Pull #480

github

nie7321
Update ComponentRegistryTest.php
Pull Request #480: Laravel 12

818 of 1380 relevant lines covered (59.28%)

45.07 hits per line

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

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

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

5
trait Arrays
6
{
7
    public static function fromPairs(array $pairs): array
8
    {
9
        //has to be array not StdClass
10
        $result = [];
×
11

12
        if (count($pairs) == 0) {
×
13
            return $result;
×
14
        }
15

16
        foreach ($pairs as $pair) {
×
17
            $result[$pair[0]] = $pair[1];
×
18
        }
19

20
        return $result;
×
21
    }
22

23
    public static function join(array $array, string $separator = ','): string
24
    {
25
        return implode($separator, $array);
×
26
    }
27

28
    public static function slice(array $array, int $start = 0, int $end = null): array
29
    {
30
        if ($end == null) {
×
31
            return array_slice($array, $start);
×
32
        }
33

34
        return array_slice($array, $start, $end - $start);
×
35
    }
36

37
    public static function sortedIndex(array $array, mixed $value): int
38
    {
39
        $size = count($array);
×
40
        if ($size == 0) {
×
41
            return 0;
×
42
        }
43
        if ($value > $array[$size - 1]) {
×
44
            return $size;
×
45
        }
46
        for ($i = 0; $i < $size; $i++) {
×
47
            if ($array[$i] >= $value) {
×
48
                return $i;
×
49
            }
50
        }
51
    }
52

53
    public static function sortedIndexOf(array $array, mixed $value): int
54
    {
55
        return \_\indexOf($array, $value);
×
56
    }
57

58
    public static function sortedLastIndex(array $array, mixed $value): int
59
    {
60
        $size = count($array);
×
61
        if ($size == 0) {
×
62
            return 0;
×
63
        }
64
        if ($value < $array[0]) {
×
65
            return 0;
×
66
        }
67
        for ($i = $size - 1; $i >= 0; $i--) {
×
68
            if ($value >= $array[$i]) {
×
69
                return $i + 1;
×
70
            }
71
        }
72
    }
73

74
    public static function sortedLastIndexOf(array $array, mixed $value): int
75
    {
76
        return \_\lastIndexOf($array, $value);
×
77
    }
78

79
    public static function sortedUniq(array $array): array
80
    {
81
        return array_values(array_unique($array));
×
82
    }
83
}
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