Resource::getData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
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