SendPlanets   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 3
dl 0
loc 58
ccs 0
cts 33
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A configure() 0 12 1
A execute() 0 15 3
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