QueueTabMenuTrait   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B configureTabMenu() 0 24 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