ExternalEntity::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 0
c 1
b 0
f 0
dl 0
loc 3
ccs 1
cts 1
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace ExternalFeedParser\Entity;
4
5
use Illuminate\Support\Arr;
6
7
/**
8
 * DTO class between package and app
9
 */
10
class ExternalEntity
11
{
12 3
    public function __construct(
13
        protected array $data = []
14
    ) {
15 3
    }
16
17 2
    public function get(string|null $key = null, mixed $default = null): mixed
18
    {
19 2
        if (is_null($key)) {
20 2
            return $this->data;
21
        }
22
23 2
        return Arr::get($this->data, $key, $default);
24
    }
25
}
26