Completed
Push — master ( b5fb47...8bb9d4 )
by Nate
02:22
created

ToArray::collection()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 8
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
crap 2
1
<?php
2
3
/**
4
 * @author    Flipbox Factory
5
 * @copyright Copyright (c) 2017, Flipbox Digital
6
 * @link      https://github.com/flipbox/transform/releases/latest
7
 * @license   https://github.com/flipbox/transform/blob/master/LICENSE
8
 */
9
10
namespace Flipbox\Transform;
11
12
use Flipbox\Transform\Resources\Collection;
13
use Flipbox\Transform\Resources\Item;
14
use Flipbox\Transform\Scope\ArrayScope;
15
use Flipbox\Transform\Transform\ArrayTransform;
16
17
/**
18
 * @author Flipbox Factory <[email protected]>
19
 * @since 1.0.0
20
 */
21
class ToArray
22
{
23
    /**
24
     * @param array $config
25
     * @return Collection
26
     */
27
    public static function collection(array $config = []): Collection
28
    {
29
        return Factory::collection(
30
            new ArrayScope(
31
                new ArrayTransform($config)
32
            )
33
        );
34
    }
35
36
    /**
37
     * @param array $config
38
     * @return Item
39
     */
40
    public static function item(array $config = []): Item
41
    {
42
        return Factory::item(
43
            new ArrayScope(
44
                new ArrayTransform($config)
45
            )
46
        );
47
    }
48
}
49