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

BusHelper::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 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