Completed
Pull Request — master (#19)
by Michal
03:25
created

RabbitMQHeaderManager::itemsHeaders()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 23
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 21
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 23
ccs 21
cts 21
cp 1
rs 9.0856
c 0
b 0
f 0
cc 2
eloc 20
nc 2
nop 2
crap 2
1
<?php
2
3
namespace Adminerng\Drivers\RabbitMQ;
4
5
use Adminerng\Core\Column;
6
use Adminerng\Core\ListingHeaders\HeaderManagerInterface;
7
8
class RabbitMQHeaderManager implements HeaderManagerInterface
9
{
10 2 View Code Duplication
    public function databasesHeaders()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
    {
12 2
        $columns = [];
13 2
        $columns[] = (new Column('vhost', 'rabbitmq.headers.vhosts.vhost'))
14 2
            ->setSortable(true);
15 2
        $columns[] = (new Column('queues', 'rabbitmq.headers.vhosts.queues'))
16 2
            ->setSortable(true)
17 2
            ->setNumeric(true);
18 2
        $columns[] = (new Column('messages', 'rabbitmq.headers.vhosts.messages'))
19 2
            ->setSortable(true)
20 2
            ->setNumeric(true);
21 2
        return $columns;
22
    }
23
24 2 View Code Duplication
    public function tablesHeaders()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
25
    {
26 2
        $columns = [];
27 2
        $columns[] = (new Column('queue', 'rabbitmq.headers.queues.queue'))
28 2
            ->setSortable(true);
29 2
        $columns[] = (new Column('number_of_items', 'rabbitmq.headers.queues.number_of_items'))
30 2
            ->setSortable(true)
31 2
            ->setNumeric(true);
32 2
        $columns[] = (new Column('size', 'rabbitmq.headers.queues.size'))
33 2
            ->setSortable(true)
34 2
            ->setNumeric(true)
35 2
            ->setSize(true);
36
        return [
37 2
            RabbitMQDriver::TYPE_QUEUE => $columns,
38 1
        ];
39
    }
40
41 2
    public function itemsHeaders($type, $table)
42
    {
43 2
        $columns = [];
44 2
        if ($type == RabbitMQDriver::TYPE_QUEUE) {
45 2
            $columns[] = (new Column('message_body', 'rabbitmq.columns.' . $type . '.message_body'))
46 2
                ->setSortable(true)
47 2
                ->setFilterable(true);
48 2
            $columns[] = (new Column('length', 'rabbitmq.columns.' . $type . '.length'))
49 2
                ->setNumeric(true)
50 2
                ->setSortable(true)
51 2
                ->setFilterable(true);
52 2
            $columns[] = (new Column('is_truncated', 'rabbitmq.columns.' . $type . '.is_truncated'))
53 2
                ->setSortable(true)
54 2
                ->setFilterable(true);
55 2
            $columns[] = (new Column('content_encoding', 'rabbitmq.columns.' . $type . '.content_encoding'))
56 2
                ->setSortable(true)
57 2
                ->setFilterable(true);
58 2
            $columns[] = (new Column('redelivered', 'rabbitmq.columns.' . $type . '.redelivered'))
59 2
                ->setSortable(true)
60 2
                ->setFilterable(true);
61 1
        }
62 2
        return $columns;
63
    }
64
}
65