Passed
Push — master ( 8423a6...5663f2 )
by Alexander
09:42
created

LayoutViewInjection   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 17
c 1
b 0
f 0
dl 0
loc 30
ccs 13
cts 13
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getLayoutParameters() 0 8 1
A __construct() 0 12 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\ViewInjection;
6
7
use App\ApplicationParameters;
8
use Yiisoft\Assets\AssetManager;
9
use Yiisoft\I18n\Locale;
10
use Yiisoft\Router\UrlGeneratorInterface;
11
use Yiisoft\Router\UrlMatcherInterface;
12
use Yiisoft\Yii\View\LayoutParametersInjectionInterface;
13
14
final class LayoutViewInjection implements LayoutParametersInjectionInterface
15
{
16
    private ApplicationParameters $applicationParameters;
17
    private AssetManager $assetManager;
18
    private Locale $locale;
19
    private UrlGeneratorInterface $urlGenerator;
20
    private UrlMatcherInterface $urlMatcher;
21
22 2
    public function __construct(
23
        ApplicationParameters $applicationParameters,
24
        AssetManager $assetManager,
25
        Locale $locale,
26
        UrlGeneratorInterface $urlGenerator,
27
        UrlMatcherInterface $urlMatcher
28
    ) {
29 2
        $this->applicationParameters = $applicationParameters;
30 2
        $this->assetManager = $assetManager;
31 2
        $this->locale = $locale;
32 2
        $this->urlGenerator = $urlGenerator;
33 2
        $this->urlMatcher = $urlMatcher;
34 2
    }
35
36 2
    public function getLayoutParameters(): array
37
    {
38
        return [
39 2
            'applicationParameters' => $this->applicationParameters,
40 2
            'assetManager' => $this->assetManager,
41 2
            'locale' => $this->locale,
42 2
            'urlGenerator' => $this->urlGenerator,
43 2
            'urlMatcher' => $this->urlMatcher,
44
        ];
45
    }
46
}
47