Completed
Push — master ( ee406a...a0eb04 )
by Klochok
14:02
created

src/menus/DashboardItem.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * Domain plugin for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-domain
6
 * @package   hipanel-module-domain
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\modules\ticket\menus;
12
13
use hipanel\helpers\Url;
14
use hipanel\modules\client\ClientWithCounters;
15
use hiqdev\yii2\menus\Menu;
16
use Yii;
17
18
class DashboardItem extends Menu
19
{
20
    protected ClientWithCounters $clientWithCounters;
0 ignored issues
show
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_STRING, expecting T_FUNCTION or T_CONST
Loading history...
21
22
    public function __construct(ClientWithCounters $clientWithCounters, $config = [])
23
    {
24
        $this->clientWithCounters = $clientWithCounters;
25
        parent::__construct($config);
26
    }
27
28
    public function items()
29
    {
30
        return Yii::$app->user->can('ticket.read') ? [
31
            'ticket' => [
32
                'label' => $this->render('dashboardItem', array_merge($this->clientWithCounters->getWidgetData('ticket'), [
33
                    'route' => Url::toRoute('@ticket/index'),
34
                ])),
35
                'encode' => false,
36
            ],
37
        ] : [];
38
    }
39
}
40