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

JBZoo / Data / 7796885268

28 Jan 2024 08:47AM UTC coverage: 98.958%. Remained the same
7796885268

push

github

web-flow
Add PHP 8.3 support and update dependencies in composer.json (#31)

190 of 192 relevant lines covered (98.96%)

38.97 hits per line

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

100.0
/src/functions.php
1
<?php
2

3
/**
4
 * JBZoo Toolbox - Data.
5
 *
6
 * This file is part of the JBZoo Toolbox project.
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @license    MIT
11
 * @copyright  Copyright (C) JBZoo.com, All rights reserved.
12
 * @see        https://github.com/JBZoo/Data
13
 */
14

15
declare(strict_types=1);
16

17
namespace JBZoo\Data;
18

19
function json(mixed $data = null): JSON
20
{
21
    if ($data instanceof JSON) {
108✔
22
        return $data;
6✔
23
    }
24

25
    if (\is_string($data)) {
108✔
26
        $result = new JSON($data);
96✔
27
    } else {
28
        $result = new JSON((array)$data);
18✔
29
    }
30

31
    return $result;
108✔
32
}
33

34
function data(mixed $data = null): Data
35
{
36
    if ($data instanceof Data) {
6✔
37
        return $data;
6✔
38
    }
39

40
    if (\is_string($data)) {
6✔
41
        $result = new Data($data);
6✔
42
    } else {
43
        $result = new Data((array)$data);
6✔
44
    }
45

46
    return $result;
6✔
47
}
48

49
function phpArray(mixed $data = null): PhpArray
50
{
51
    if ($data instanceof PhpArray) {
6✔
52
        return $data;
6✔
53
    }
54

55
    if (\is_string($data)) {
6✔
56
        $result = new PhpArray($data);
6✔
57
    } else {
58
        $result = new PhpArray((array)$data);
6✔
59
    }
60

61
    return $result;
6✔
62
}
63

64
function ini(mixed $data = null): Ini
65
{
66
    if ($data instanceof Ini) {
6✔
67
        return $data;
6✔
68
    }
69

70
    if (\is_string($data)) {
6✔
71
        $result = new Ini($data);
6✔
72
    } else {
73
        $result = new Ini((array)$data);
6✔
74
    }
75

76
    return $result;
6✔
77
}
78

79
function yml(mixed $data = null): Yml
80
{
81
    if ($data instanceof Yml) {
12✔
82
        return $data;
6✔
83
    }
84

85
    if (\is_string($data)) {
12✔
86
        $result = new Yml($data);
12✔
87
    } else {
88
        $result = new Yml((array)$data);
12✔
89
    }
90

91
    return $result;
12✔
92
}
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