ValuesBag::get()   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 2
dl 0
loc 3
rs 10
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
}