Passed
Push — master ( e274a9...c7178b )
by Alexander
19:43 queued 16:19
created

CommonViewInjection   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 18
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getCommonParameters() 0 5 1
A __construct() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\ViewInjection;
6
7
use Yiisoft\Form\Widget\Field;
8
use Yiisoft\Router\UrlGeneratorInterface;
9
use Yiisoft\Yii\View\CommonParametersInjectionInterface;
10
11
class CommonViewInjection implements CommonParametersInjectionInterface
12
{
13
    private UrlGeneratorInterface $url;
14
    private Field $field;
15
16 10
    public function __construct(
17
        UrlGeneratorInterface $url,
18
        Field $field
19
    ) {
20 10
        $this->url = $url;
21 10
        $this->field = $field;
22 10
    }
23
24 10
    public function getCommonParameters(): array
25
    {
26
        return [
27 10
            'field' => $this->field,
28 10
            'url' => $this->url,
29
        ];
30
    }
31
}
32