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

ArrayToObject   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 21
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
transform() 0 1 ?
A __invoke() 0 5 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\Transformers\Traits;
11
12
use Flipbox\Transform\Resources\ResourceInterface;
13
use Flipbox\Transform\Scope;
14
15
/**
16
 * @author Flipbox Factory <[email protected]>
17
 * @since 1.0.0
18
 */
19
trait ArrayToObject
20
{
21
    use ArrayData;
22
23
    /**
24
     * @param array $data
25
     * @param $scope
26
     * @param $identifier
27
     * @return mixed
28
     */
29
    abstract public function transform(array $data, $scope, $identifier);
30
31
    /**
32
     * @inheritdoc
33
     */
34
    public function __invoke($data, Scope $scope, string $identifier = null)
35
    {
36
        $data = $this->normalizeData($data, $scope);
37
        return $this->transform($data, $scope, $identifier);
38
    }
39
}
40