Passed
Push — master ( cca6b1...f7b887 )
by Alexander
10:54
created

ContentViewInjection   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 22
rs 10
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
    public function __construct(
19
        UrlMatcherInterface $urlMatcher,
20
        UrlGeneratorInterface $url,
21
        Field $field
22
    ) {
23
        $this->urlMatcher = $urlMatcher;
24
        $this->url = $url;
25
        $this->field = $field;
26
    }
27
28
    public function getContentParameters(): array
29
    {
30
        return [
31
            'field' => $this->field,
32
            'url' => $this->url,
33
            'urlMatcher' => $this->urlMatcher,
34
        ];
35
    }
36
}
37