Code Duplication    Length = 31-31 lines in 3 locations

src/Reith/ToyRobot/Console/Left.php 1 location

@@ 19-49 (lines=31) @@
16
use Symfony\Component\Console\Input\InputArgument;
17
use Reith\ToyRobot\Messaging\Command\TurnLeft;
18
19
class Left extends Command
20
{
21
    protected function configure()
22
    {
23
        $this
24
            ->setName('LEFT')
25
            ->setDescription('Turn the robot to the left')
26
            ->setHelp(<<<EOT
27
The <info>robot:left</info> instruction will tell the robot to turn left.
28
29
<info>./toyrobot</info> <comment>LEFT</comment>
30
31
EOT
32
        );
33
    }
34
35
    /**
36
     * @param InputInterface  $input
37
     * @param OutputInterface $output
38
     */
39
    protected function execute(InputInterface $input, OutputInterface $output)
40
    {
41
        $message = new TurnLeft();
42
43
        $this->getHelper('bus')->postCommand($message);
44
45
        $this->getApplication()
46
            ->find('REPORT')
47
            ->run($input, $output);
48
    }
49
}
50

src/Reith/ToyRobot/Console/Move.php 1 location

@@ 19-49 (lines=31) @@
16
use Symfony\Component\Console\Input\InputArgument;
17
use Reith\ToyRobot\Messaging\Command\MoveForward;
18
19
class Move extends Command
20
{
21
    protected function configure()
22
    {
23
        $this
24
            ->setName('MOVE')
25
            ->setDescription('Move the robot forward')
26
            ->setHelp(<<<EOT
27
The <info>MOVE</info> instruction will tell the robot to move forward.
28
29
<info>./toyrobot</info> <comment>MOVE</comment>
30
31
EOT
32
        );
33
    }
34
35
    /**
36
     * @param InputInterface  $input
37
     * @param OutputInterface $output
38
     */
39
    protected function execute(InputInterface $input, OutputInterface $output)
40
    {
41
        $message = new MoveForward();
42
43
        $this->getHelper('bus')->postCommand($message);
44
45
        $this->getApplication()
46
            ->find('REPORT')
47
            ->run($input, $output);
48
    }
49
}
50

src/Reith/ToyRobot/Console/Right.php 1 location

@@ 19-49 (lines=31) @@
16
use Symfony\Component\Console\Input\InputArgument;
17
use Reith\ToyRobot\Messaging\Command\TurnRight;
18
19
class Right extends Command
20
{
21
    protected function configure()
22
    {
23
        $this
24
            ->setName('RIGHT')
25
            ->setDescription('Turn the robot to the right')
26
            ->setHelp(<<<EOT
27
The <info>RIGHT</info> instruction will tell the robot to turn right.
28
29
<info>./toyrobot</info> <comment>RIGHT</comment>
30
31
EOT
32
        );
33
    }
34
35
    /**
36
     * @param InputInterface  $input
37
     * @param OutputInterface $output
38
     */
39
    protected function execute(InputInterface $input, OutputInterface $output)
40
    {
41
        $message = new TurnRight();
42
43
        $this->getHelper('bus')->postCommand($message);
44
45
        $this->getApplication()
46
            ->find('REPORT')
47
            ->run($input, $output);
48
    }
49
}
50