Completed
Push — master ( bce2bd...fc52ee )
by Douglas
01:38
created

BusHelper   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Test Coverage

Coverage 70.59%

Importance

Changes 0
Metric Value
wmc 6
lcom 2
cbo 1
dl 0
loc 49
ccs 12
cts 17
cp 0.7059
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A setHelperSet() 0 4 1
A getHelperSet() 0 4 1
A getName() 0 4 1
A postCommand() 0 4 1
A postQuery() 0 4 1
1
<?php
2
3
/**
4
 * (c) 2018 Douglas Reith.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
declare(strict_types=1);
10
11
namespace Reith\ToyRobot\Console;
12
13
use Symfony\Component\Console\Helper\HelperInterface;
14
use Symfony\Component\Console\Helper\HelperSet;
15
use Reith\ToyRobot\Messaging\BusInterface;
16
17
class BusHelper implements HelperInterface
18
{
19
    private $helperSet;
20
21
    private $commandBus;
22
23
    private $queryBus;
24
25 7
    public function __construct(BusInterface $commandBus, BusInterface $queryBus)
26
    {
27 7
        $this->commandBus = $commandBus;
28 7
        $this->queryBus = $queryBus;
29 7
    }
30
31 7
    public function setHelperSet(HelperSet $helperSet = null)
32
    {
33 7
        $this->helperSet = $helperSet;
34 7
    }
35
36
    /**
37
     * Gets the helper set associated with this helper.
38
     *
39
     * @return HelperSet A HelperSet instance
40
     */
41
    public function getHelperSet()
42
    {
43
        return $this->getHelperSet;
0 ignored issues
show
Bug introduced by
The property getHelperSet does not seem to exist. Did you mean helperSet?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
44
    }
45
46
    /**
47
     * Returns the canonical name of this helper.
48
     *
49
     * @return string The canonical name
50
     */
51 7
    public function getName()
52
    {
53 7
        return 'bus';
54
    }
55
56 1
    public function postCommand($message)
57
    {
58 1
        $this->commandBus->post($message);
59 1
    }
60
61
    public function postQuery($message)
62
    {
63
        $this->queryBus->post($message);
64
    }
65
}
66