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
|
|
|
|