ValuesBag   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A get() 0 3 1
1
<?php
2
3
namespace pjpawel\LightApi\Http;
4
5
class ValuesBag
6
{
7
8
    /**
9
     * @var array<string, mixed>
10
     */
11
    public array $parameters;
12
13
    public function __construct(array $parameters)
14
    {
15
        $this->parameters = $parameters;
16
    }
17
18
    /**
19
     * @param string $key
20
     * @param mixed $default
21
     * @return string|int|null
22
     */
23
    public function get(string $key, mixed $default = null): string|int|null
24
    {
25
        return $this->parameters[$key] ?? $default;
26
    }
27
}