SendPlanets::execute()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
dl 0
loc 15
ccs 0
cts 13
cp 0
rs 9.7666
c 0
b 0
f 0
cc 3
nc 4
nop 2
crap 12
1
<?php
2
3
namespace eXpansion\Framework\GameCurrencyBundle\ChatCommand;
4
5
use eXpansion\Framework\AdminGroups\Helpers\AdminGroups;
6
use eXpansion\Framework\AdminGroups\Model\AbstractAdminChatCommand;
7
use eXpansion\Framework\GameCurrencyBundle\Plugins\Gui\BillWindow;
8
use Symfony\Component\Console\Input\InputArgument;
9
use Symfony\Component\Console\Input\InputInterface;
10
11
/**
12
 *
13
 * @author  reaby
14
 */
15
class SendPlanets extends AbstractAdminChatCommand
16
{
17
    /** @var BillWindow */
18
    private $billWindow;
19
20
    /**
21
     * ScriptPanel constructor.
22
     *
23
     * @param                      $command
24
     * @param                      $permission
25
     * @param array                $aliases
26
     * @param BillWindow           $billWindow
27
     * @param AdminGroups          $adminGroups
28
     */
29
    public function __construct(
30
        $command,
31
        $permission,
32
        array $aliases = [],
33
        BillWindow $billWindow,
34
        AdminGroups $adminGroups
35
    ) {
36
        parent::__construct($command, $permission, $aliases, $adminGroups);
37
        $this->billWindow = $billWindow;
38
    }
39
40
    protected function configure()
41
    {
42
        parent::configure();
43
44
        $this->inputDefinition->addArgument(
45
            new InputArgument('login', InputArgument::OPTIONAL, "Login to send")
46
        );
47
        $this->inputDefinition->addArgument(
48
            new InputArgument('amount', InputArgument::OPTIONAL, "amount to send")
49
        );
50
51
    }
52
53
54
    /**
55
     * @inheritdoc
56
     */
57
    public function execute($login, InputInterface $input)
58
    {
59
        $login2 = "";
60
        $amount = 0;
61
        if ($input->hasArgument("login")) {
62
            $login2 = $input->getArgument("login");
63
        }
64
        if ($input->hasArgument("amount")) {
65
66
            $amount = $input->getArgument("amount");
67
        }
68
69
        $this->billWindow->setDetails($login2, $amount);
70
        $this->billWindow->create($login);
71
    }
72
}
73