Code Duplication    Length = 19-22 lines in 2 locations

Command/ChannelsCommand.php 1 location

@@ 48-69 (lines=22) @@
45
    /**
46
     * {@inheritdoc}
47
     */
48
    protected function execute(InputInterface $input, OutputInterface $output): int
49
    {
50
        $io = new SymfonyStyle($input, $output);
51
52
        try {
53
            $data = $this->centrifugo->channels();
54
55
            if (!empty($data['channels'])) {
56
                $io->title('Channels');
57
                $io->listing($data['channels']);
58
                $io->text(\sprintf('<info>TOTAL</info>: %d', \count($data['channels'])));
59
            } else {
60
                $io->success('NO DATA');
61
            }
62
        } catch (\Throwable $e) {
63
            $io->error($e->getMessage());
64
65
            return $e->getCode();
66
        }
67
68
        return 0;
69
    }
70
}
71

Command/PresenceStatsCommand.php 1 location

@@ 82-100 (lines=19) @@
79
    /**
80
     * {@inheritdoc}
81
     */
82
    protected function execute(InputInterface $input, OutputInterface $output): int
83
    {
84
        $io = new SymfonyStyle($input, $output);
85
86
        try {
87
            $data = $this->centrifugo->presenceStats($this->channel);
88
89
            $io->title('Presence Stats');
90
            $io->text(\sprintf('<info>num_clients</info>: <comment>%d</comment>', $data['num_clients']));
91
            $io->text(\sprintf('<info>num_users</info>: <comment>%d</comment>', $data['num_users']));
92
            $io->newLine();
93
        } catch (\Throwable $e) {
94
            $io->error($e->getMessage());
95
96
            return $e->getCode();
97
        }
98
99
        return 0;
100
    }
101
}
102