ListenersCommand::actionIndex()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
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