Completed
Push — master ( e5efba...5eb024 )
by Ivan
19:40
created

Send::money()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 9
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 4
dl 9
loc 9
rs 9.6666
c 0
b 0
f 0
ccs 0
cts 9
cp 0
crap 2
1
<?php namespace FreedomCore\TrinityCore\Console\Commands;
2
3
use FreedomCore\TrinityCore\Console\Abstracts\BaseCommand;
4
use FreedomCore\TrinityCore\Console\Classes\Items;
5
6
/**
7
 * Class Send
8
 * @package FreedomCore\TrinityCore\Console\Commands
9
 */
10
class Send extends BaseCommand
11
{
12
13
    /**
14
     * Send Items To The Player
15
     * @param string $playerName
16
     * @param string $mailSubject
17
     * @param string $mailText
18
     * @param Items $items
19
     * @return array|string
20
     */
21
    public function items(string $playerName, string $mailSubject, string $mailText, Items $items)
22
    {
23
        return $this->executeCommand(__FUNCTION__, [
24
            'playerName'    =>  $playerName,
25
            'mailSubject'   =>  $this->inQuotes($mailSubject),
26
            'mailText'      =>  $this->inQuotes($mailText),
27
            'items'         =>  $items->toCommandAttribute()
28
        ]);
29
    }
30
31
    /**
32
     * Send mail to the player
33
     * @param string $playerName
34
     * @param string $mailSubject
35
     * @param string $mailText
36
     * @return array|string
37
     */
38 View Code Duplication
    public function mail(string $playerName, string $mailSubject, string $mailText)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
39
    {
40
        return $this->executeCommand(__FUNCTION__, [
41
            'playerName'    =>  $playerName,
42
            'mailSubject'   =>  $this->inQuotes($mailSubject),
43
            'mailText'      =>  $this->inQuotes($mailText)
44
        ]);
45
    }
46
47
    /**
48
     * Send message to the player which will appear in the middle of the screen
49
     * @param string $playerName
50
     * @param string $message
51
     * @return array|string
52
     */
53
    public function message(string $playerName, string $message)
54
    {
55
        return $this->executeCommand(__FUNCTION__, get_defined_vars());
56
    }
57
58
    /**
59
     * Send money to the player
60
     * @param string $playerName
61
     * @param string $mailSubject
62
     * @param string $mailText
63
     * @param int $amount
64
     * @return array|string
65
     */
66 View Code Duplication
    public function money(string $playerName, string $mailSubject, string $mailText, int $amount)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
67
    {
68
        return $this->executeCommand(__FUNCTION__, [
69
            'playerName'    =>  $playerName,
70
            'mailSubject'   =>  $this->inQuotes($mailSubject),
71
            'mailText'      =>  $this->inQuotes($mailText),
72
            'amount'        =>  $amount
73
        ]);
74
    }
75
}
76