View   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 22
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 2
1
<?php
2
3
namespace App\Components;
4
5
use Micro\Base\IContainer;
6
use Micro\Mvc\Views\PhpView;
7
use Micro\Web\UserInjector;
8
9
/**
10
 * Class View
11
 *
12
 * @package App\Components
13
 */
14
class View extends PhpView
15
{
16
    public $title = 'Micro';
17
    public $menu = ['<a href="/">Главная</a>', '<a href="/blog/post">Блог</a>'];
18
    public $user = [];
19
20
    /**
21
     * View constructor.
22
     */
23
    public function __construct()
24
    {
25
        parent::__construct();
26
27
        if (!(new UserInjector)->build()->isGuest()) {
28
            $this->user[] = '<a href="/profile">Профиль</a>';
29
            $this->user[] = ' (<a href="/logout">Выйти</a>)';
30
        } else {
31
            $this->user[] = '<a href="/login">Войти</a>';
32
            $this->user[] = '<a href="/register">Регистрация</a>';
33
        }
34
    }
35
} 
36