ContentViewInjection   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getContentParameters() 0 6 1
A __construct() 0 8 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\Router\UrlMatcherInterface;
10
use Yiisoft\Yii\View\ContentParametersInjectionInterface;
11
12
class ContentViewInjection implements ContentParametersInjectionInterface
13
{
14
    private UrlMatcherInterface $urlMatcher;
15
    private UrlGeneratorInterface $url;
16
    private Field $field;
17
18 10
    public function __construct(
19
        UrlMatcherInterface $urlMatcher,
20
        UrlGeneratorInterface $url,
21
        Field $field
22
    ) {
23 10
        $this->urlMatcher = $urlMatcher;
24 10
        $this->url = $url;
25 10
        $this->field = $field;
26 10
    }
27
28 10
    public function getContentParameters(): array
29
    {
30
        return [
31 10
            'field' => $this->field,
32 10
            'url' => $this->url,
33 10
            'urlMatcher' => $this->urlMatcher,
34
        ];
35
    }
36
}
37