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

ArrayToObject::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 0
cts 5
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 3
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\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