ExternalEntity   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 4
c 1
b 0
f 0
dl 0
loc 14
ccs 6
cts 6
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 7 2
A __construct() 0 3 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