QueueTabMenuTrait::configureTabMenu()   B
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 24
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 24
c 0
b 0
f 0
rs 8.9713
cc 3
eloc 15
nc 2
nop 3
1
<?php
2
3
/*
4
 * This file is part of HeriJobQueueBundle.
5
 *
6
 * (c) Alexandre Mogère
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Heri\Bundle\JobQueueBundle\Admin;
13
14
use Knp\Menu\ItemInterface as MenuItemInterface;
15
use Sonata\AdminBundle\Admin\AdminInterface;
16
17
trait QueueTabMenuTrait
18
{
19
    /**
20
     * {@inheritdoc}
21
     */
22
    protected function configureTabMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null)
23
    {
24
        if (!$childAdmin && !in_array($action, ['list'])) {
25
            return;
26
        }
27
28
        $menu->addChild('link_queue_list', [
29
            'label' => 'Queues',
30
            'attributes' => ['class' => 'btn', 'icon' => 'fa fa-tasks'],
31
            'route' => 'sonata_queue_list',
32
        ]);
33
34
        $menu->addChild('link_queue_message_list', [
35
            'label' => 'Messages',
36
            'attributes' => ['class' => 'btn', 'icon' => 'fa fa-send'],
37
            'route' => 'sonata_queue_message_list',
38
        ]);
39
40
        $menu->addChild('link_queue_log_list', [
41
            'label' => 'Exceptions',
42
            'attributes' => ['class' => 'btn', 'icon' => 'fa fa-terminal'],
43
            'route' => 'sonata_queue_log_list',
44
        ]);
45
    }
46
}
47