Issues (150)

sample/views/layouts/main.php (2 issues)

1
<?php
2
3
/* @var $this \yii\web\View */
4
/* @var $content string */
5
6
use sample\assets\AppAsset;
7
use sample\widgets\Alert;
8
use yii\bootstrap4\Breadcrumbs;
9
use yii\bootstrap4\Html;
10
use yii\bootstrap4\Nav;
11
use yii\bootstrap4\NavBar;
12
13
AppAsset::register($this);
14
?>
15
<?php $this->beginPage() ?>
16
    <!DOCTYPE html>
17
    <html lang="<?= Yii::$app->language ?>" class="h-100">
18
    <head>
19
        <meta charset="<?= Yii::$app->charset ?>">
20
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
21
        <?php $this->registerCsrfMetaTags() ?>
22
        <title><?= Html::encode($this->title) ?></title>
23
        <?php $this->head() ?>
24
    </head>
25
    <body class="d-flex flex-column h-100">
26
    <?php $this->beginBody() ?>
27
28
    <header>
29
        <?php
30
        NavBar::begin([
31
            'brandLabel' => Yii::$app->name,
32
            'brandUrl' => Yii::$app->homeUrl,
33
            'options' => [
34
                'class' => 'navbar navbar-expand-md navbar-dark bg-dark fixed-top',
35
            ],
36
        ]);
37
        echo Nav::widget([
38
            'options' => ['class' => 'navbar-nav'],
39
            'items' => [
40
                ['label' => 'Home', 'url' => ['/site/index']],
41
                ['label' => 'About', 'url' => ['/site/about']],
42
                ['label' => 'Contact', 'url' => ['/site/contact']],
43
                Yii::$app->user->isGuest
44
                    ? ['label' => 'Login', 'url' => ['/user/login']]
45
                    : (
46
                        '<li>'
47
                        . Html::beginForm(['/site/logout'], 'post', ['class' => 'form-inline'])
48
                        . Html::submitButton(
49
                            'Logout (' . Yii::$app->user->identity->username . ')',
0 ignored issues
show
Accessing username on the interface yii\web\IdentityInterface suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
50
                            ['class' => 'btn btn-link logout']
51
                        )
52
                        . Html::endForm()
53
                        . '</li>'
54
                    )
55
            ],
56
        ]);
57
        NavBar::end();
58
        ?>
59
    </header>
60
61
    <main role="main" class="flex-shrink-0">
62
        <div class="container">
63
            <?= Breadcrumbs::widget([
64
                'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
65
            ]) ?>
66
            <?= Alert::widget() ?>
67
            <?= $content ?>
68
        </div>
69
    </main>
70
71
    <footer class="footer mt-auto py-3 text-muted">
72
        <div class="container">
73
            <p class="float-left">&copy; My Company <?= date('Y') ?></p>
74
            <p class="float-right"><?= Yii::powered() ?></p>
0 ignored issues
show
Deprecated Code introduced by
The function yii\BaseYii::powered() has been deprecated: since 2.0.14, this method will be removed in 2.1.0. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

74
            <p class="float-right"><?= /** @scrutinizer ignore-deprecated */ Yii::powered() ?></p>

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
75
        </div>
76
    </footer>
77
78
    <?php $this->endBody() ?>
79
    </body>
80
    </html>
81
<?php $this->endPage() ?>
82