Passed
Push — master ( e0508e...1ccf58 )
by Alexander
02:12
created

RequestModel   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getRequestData() 0 3 1
A setRequestData() 0 3 1
A hasAttribute() 0 3 1
A getAttributeValue() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\RequestModel;
6
7
use Yiisoft\Arrays\ArrayHelper;
8
9
abstract class RequestModel implements RequestModelInterface
10
{
11
    private array $requestData = [];
12
13 11
    public function setRequestData(array $requestData): void
14
    {
15 11
        $this->requestData = $requestData;
16 11
    }
17
18 8
    public function getAttributeValue(string $attribute, $default = null)
19
    {
20 8
        return ArrayHelper::getValueByPath($this->requestData, $attribute, $default);
21
    }
22
23 1
    public function hasAttribute(string $attribute): bool
24
    {
25 1
        return ArrayHelper::pathExists($this->requestData, $attribute);
26
    }
27
28 2
    public function getRequestData(): array
29
    {
30 2
        return $this->requestData;
31
    }
32
}
33