LayoutViewInjection   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 13
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getLayoutParameters() 0 7 2
A __construct() 0 2 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\ViewInjection;
6
7
use App\Auth\Identity;
8
use Yiisoft\User\CurrentUser;
0 ignored issues
show
Bug introduced by
The type Yiisoft\User\CurrentUser was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Yiisoft\Yii\View\Renderer\LayoutParametersInjectionInterface;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Yii\View\Rendere...etersInjectionInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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