Completed
Push — master ( 1d4eca...2da837 )
by Lars
01:50
created

Create.php ➔ collection()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 4
ccs 1
cts 1
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arrayy;
6
7
use Arrayy\Collection\Collection;
8
use Arrayy\Collection\CollectionInterface;
9
10
if (!\function_exists('Arrayy\create')) {
11
    /**
12
     * Creates a Arrayy object.
13
     *
14
     * @param mixed $data
15
     *
16
     * @return Arrayy
17
     */
18
    function create($data): Arrayy
19
    {
20 1
        return new Arrayy($data);
21
    }
22
23
    /**
24
     * Creates a Collection object.
25
     *
26
     * @param string $type
27
     * @param mixed  $data
28
     *
29
     * @return CollectionInterface
30
     */
31
    function collection($type, $data = []): CollectionInterface
32
    {
33 2
        return new Collection($type, $data);
34
    }
35
}
36