Resource   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 4
c 2
b 0
f 0
dl 0
loc 28
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getData() 0 3 1
1
<?php
2
3
namespace Signifly\ParcelShop\Resources;
4
5
/**
6
 * @internal
7
 */
8
abstract class Resource
9
{
10
    /**
11
     * The data for the resource.
12
     *
13
     * @var array
14
     */
15
    protected $data;
16
17
    /**
18
     * Create a new Resource instance.
19
     *
20
     * @param array $data
21
     */
22
    public function __construct(array $data)
23
    {
24
        $this->data = $data;
25
    }
26
27
    /**
28
     * Get data for the resource by the provided key.
29
     *
30
     * @param  string $key
31
     * @return mixed
32
     */
33
    public function getData(string $key)
34
    {
35
        return data_get($this->data, $key);
36
    }
37
}
38