Completed
Push — master ( 605dcd...eeb8ed )
by Nate
02:13
created

Factory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 33
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A collection() 0 4 1
A item() 0 4 1
A transform() 0 4 1
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\Transformers\TransformerInterface;
13
14
/**
15
 * @author Flipbox Factory <[email protected]>
16
 * @since 1.0.0
17
 */
18
class Factory
19
{
20
    /**
21
     * @param callable|TransformerInterface $transformer
22
     * @param $data
23
     * @param array $config
24
     * @return array|null
25
     */
26
    public static function collection(callable $transformer, $data, array $config = [])
27
    {
28
        return self::transform($config)->collection($transformer, $data);
29
    }
30
31
    /**
32
     * @param callable|TransformerInterface $transformer
33
     * @param $data
34
     * @param array $config
35
     * @return array|null
36
     */
37
    public static function item(callable $transformer, $data, array $config = [])
38
    {
39
        return self::transform($config)->item($transformer, $data);
40
    }
41
42
    /**
43
     * @param array $config
44
     * @return Transform
45
     */
46
    public static function transform(array $config = []): Transform
47
    {
48
        return new Transform($config);
49
    }
50
}
51