Passed
Pull Request — master (#75)
by
unknown
12:43
created

MyWebViewConverter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 8
c 1
b 0
f 0
dl 0
loc 15
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getLayoutParams() 0 5 1
A __construct() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Stream\Data;
6
7
use Yiisoft\Aliases\Aliases;
8
use Yiisoft\Yii\Web\User\User;
9
use Yiisoft\View\WebView;
10
11
final class MyWebViewConverter extends WebViewConverter
12
{
13
    protected ?string $viewPath = '@view';
14
    private User $identity;
15
16
    public function __construct(WebView $webView, Aliases $aliases, User $identity)
17
    {
18
        parent::__construct($webView, $aliases);
19
        $this->identity = $identity;
20
    }
21
    protected function getLayoutParams(string $pageContent): array
22
    {
23
        return [
24
            'content' => $pageContent,
25
            'user' => $this->identity->getIdentity(),
26
        ];
27
    }
28
}
29