Completed
Push — master ( c9dd00...4d2f0d )
by Nathan
02:17
created

SendMany::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 4
cts 4
cp 1
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 4
crap 1
1
<?php
2
3
namespace ZenCash\Rpc\Command\Wallet;
4
5
use ZenCash\Rpc\Command;
6
7
final class SendMany implements Command
8
{
9
    private const METHOD = 'sendmany';
10
    private $account = '';
11
    private $amounts;
12
    private $minConfig;
13
    private $comment;
14
    private $subtractFromAddresses;
15
16
    /**
17
     * SendMany constructor
18
     * @param Amount[] $amounts
19
     * @param int $minConfig
20
     * @param string $comment
21
     * @param string[] $subtractFromAddresses
22
     */
23
    public function __construct(array $amounts, int $minConfig = 1, string $comment = '', array $subtractFromAddresses = [])
24
    {
25
        call_user_func_array(function(Amount ...$amounts) {}, $amounts);
0 ignored issues
show
Unused Code introduced by
The parameter $amounts is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

25
        call_user_func_array(function(/** @scrutinizer ignore-unused */ Amount ...$amounts) {}, $amounts);

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
26
        call_user_func_array(function(string ...$addresses) {}, $subtractFromAddresses);
0 ignored issues
show
Unused Code introduced by
The parameter $addresses is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

26
        call_user_func_array(function(/** @scrutinizer ignore-unused */ string ...$addresses) {}, $subtractFromAddresses);

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
27
28 2
        $this->amounts = $amounts;
29 2
        $this->minConfig = $minConfig;
30 2
        $this->comment = $comment;
31 2
        $this->subtractFromAddresses = $subtractFromAddresses;
32 2
    }
33
34 2
    public function jsonSerialize(): object
35
    {
36
        return (object) [
37 2
            'jsonrpc' => Command::JSON_RPC_VERSION,
38
            'id'      => Command::ID,
39 2
            'method'  => self::METHOD,
40
            'params' => [
41 2
                $this->account,
42 2
                $this->amounts,
43 2
                $this->minConfig,
44 2
                $this->comment,
45 2
                $this->subtractFromAddresses
46
            ]
47
        ];
48
    }
49
}
50