Passed
Pull Request — master (#122)
by
unknown
16:22 queued 01:22
created

ApplicationInjection::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 6
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\ViewRenderer;
6
7
use Yiisoft\Router\UrlMatcherInterface;
8
use Yiisoft\Yii\Web\User\User;
9
10
class ApplicationInjection extends AbstractInjection
11
{
12
13
    private User $user;
14
    private UrlMatcherInterface $urlMatcher;
15
16
    public function __construct(
17
        User $user,
18
        UrlMatcherInterface $urlMatcher
19
    ) {
20
        $this->user = $user;
21
        $this->urlMatcher = $urlMatcher;
22
    }
23
24
    public function getLayoutParams(): array
25
    {
26
        return [
27
            'user' => $this->user->getIdentity(),
28
            'currentUrl' => (string)$this->urlMatcher->getLastMatchedRequest()->getUri(),
29
            'brandLabel' => 'Yii Demo',
30
        ];
31
    }
32
33
    public function getMetaTags(): array
34
    {
35
        return [
36
            [
37
                '__key' => 'generator',
38
                'name' => 'generator',
39
                'value' => 'Yii',
40
            ],
41
        ];
42
    }
43
44
    public function getLinkTags(): array
45
    {
46
        return [
47
            [
48
                '__key' => 'favicon',
49
                'name' => 'icon',
50
                'value' => 'favicon.ico',
51
            ],
52
        ];
53
    }
54
}
55