PingCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 4
dl 0
loc 25
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 6 1
A execute() 0 5 1
A get() 0 4 1
1
<?php
2
3
namespace Happyr\SimpleBusBundle\Command;
4
5
use Happyr\SimpleBusBundle\Message\Command\Ping;
6
use Happyr\SimpleBusBundle\Message\Event\Pong;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
10
11
/**
12
 * Test if SimpleBus works.
13
 *
14
 * @author Tobias Nyholm <[email protected]>
15
 */
16
class PingCommand extends ContainerAwareCommand
17
{
18
    protected function configure()
19
    {
20
        $this
21
            ->setName('happyr:simplebus:ping')
22
            ->setDescription('Ping test');
23
    }
24
25
    protected function execute(InputInterface $input, OutputInterface $output)
26
    {
27
        $this->get('command_bus')->handle(new Ping('4711'));
28
        $this->get('event_bus')->handle(new Pong('4711-pong'));
29
    }
30
31
    /**
32
     * @param string $service
33
     *
34
     * @return object
35
     */
36
    private function get(string $service)
37
    {
38
        return $this->getContainer()->get($service);
39
    }
40
}
41