AbstractResource::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

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 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
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\Resources;
11
12
use Flipbox\Transform\Scope;
13
14
/**
15
 * @author Flipbox Factory <[email protected]>
16
 * @since 3.0.0
17
 */
18
abstract class AbstractResource implements ResourceInterface
19
{
20
    /**
21
     * @var mixed
22
     */
23
    protected $data;
24
25
    /**
26
     * @var callable
27
     */
28
    protected $transformer;
29
30
    /**
31
     * ArrayItem constructor.
32
     * @param $data
33
     * @param callable $transformer
34
     */
35
    public function __construct($data, callable $transformer)
36
    {
37
        $this->data = $data;
38
        $this->transformer = $transformer;
39
    }
40
41
    /**
42
     * @inheritdoc
43
     */
44
    abstract public function __invoke(Scope $scope, string $identifier = null, ...$params);
45
}
46