ListenersCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A actionIndex() 0 5 1
A getTable() 0 8 2
1
<?php
2
3
namespace App\Ship\Command;
4
5
use Rudra\EventDispatcher\EventDispatcherFacade as EventDispatcher;
6
7
class ListenersCommand
8
{
9
    public function actionIndex(): void
10
    {
11
        $mask = "|%-5.5s |%-20.20s|%-45.45s|%-20.20s| x |" . PHP_EOL;
12
        printf("\e[1;35m" . $mask . "\e[m", " ", "event", "listener", "action");
13
        $this->getTable(EventDispatcher::getListeners());
14
    }
15
16
    protected function getTable(array $data): void
17
    {
18
        $mask = "|%-5.5s |%-20.20s|%-45.45s|%-20.20s| x |" . PHP_EOL;
19
        $i    = 1;
20
21
        foreach ($data as $name => $listeners) {
22
            printf("\e[5;36m" . $mask . "\e[m", $i, $name, $listeners["listener"], $listeners["method"]);
23
            $i++;
24
        }
25
    }
26
}
27