Test Failed
Pull Request — master (#494)
by
unknown
03:32
created

LayoutViewInjection::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Http\ViewInjection;
6
7
use App\Modules\Auth\Identity;
8
use Yiisoft\User\CurrentUser;
9
use Yiisoft\Yii\View\LayoutParametersInjectionInterface;
10
11
final class LayoutViewInjection implements LayoutParametersInjectionInterface
12
{
13
    public function __construct(private CurrentUser $currentUser)
14
    {
15
    }
16
17
    public function getLayoutParameters(): array
18
    {
19
        $identity = $this->currentUser->getIdentity();
20
21
        return [
22
            'brandLabel' => 'Yii Demo',
23
            'user' => $identity instanceof Identity ? $identity->getUser() : null,
24
        ];
25
    }
26
}
27