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

contributte / datagrid / 8230157862

11 Mar 2024 09:02AM UTC coverage: 34.102%. First build
8230157862

Pull #1060

github

radimvaculik
Fix failing tests
Pull Request #1060: [7.x] Next

117 of 435 new or added lines in 54 files covered. (26.9%)

1124 of 3296 relevant lines covered (34.1%)

0.34 hits per line

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

17.65
/src/Utils/ArraysHelper.php
1
<?php declare(strict_types = 1);
2

3
namespace Contributte\Datagrid\Utils;
4

5
final class ArraysHelper
6
{
7

8
        /**
9
         * Test recursively whether given array is empty
10
         */
11
        public static function testEmpty(iterable $array): bool
1✔
12
        {
13
                foreach ($array as $value) {
1✔
14
                        if (is_array($value)) {
×
15
                                if (!self::testEmpty($value)) {
×
16
                                        return false;
×
17
                                }
18
                        } else {
19
                                if ($value) {
×
20
                                        return false;
×
21
                                }
22

23
                                if (in_array($value, [0, '0', false], true)) {
×
24
                                        return false;
×
25
                                }
26
                        }
27
                }
28

29
                return true;
1✔
30
        }
31

32
        /**
33
         * Is array and its values truthy?
34
         */
35
        public static function testTruthy(iterable $iterable): bool
36
        {
37
                foreach ($iterable as $value) {
×
NEW
38
                        if (is_iterable($value)) {
×
39
                                if (self::testTruthy($value)) {
×
40
                                        return true;
×
41
                                }
42
                        } else {
43
                                if ($value !== '' && $value !== null) {
×
44
                                        return true;
×
45
                                }
46
                        }
47
                }
48

49
                return false;
×
50
        }
51

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

© 2025 Coveralls, Inc