Issues (12)

Command/RawTransactions/CreateRawTransaction.php (2 issues)

Severity
1
<?php
2
3
namespace ZenCash\Rpc\Command\RawTransactions;
4
5
use ZenCash\Rpc\Command;
6
7
final class CreateRawTransaction implements Command
8
{
9
    private const METHOD = 'createrawtransaction';
10
    private $transactions;
11
    private $recipients;
12
13
    /**
14
     * @param RawTransaction[] $transactions
15
     * @param Recipient[] $recipients
16
     */
17
    public function __construct(array $transactions, array $recipients)
18
    {
19
        call_user_func_array(function(RawTransaction ...$t) {}, $transactions);
0 ignored issues
show
The parameter $t 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

19
        call_user_func_array(function(/** @scrutinizer ignore-unused */ RawTransaction ...$t) {}, $transactions);

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...
20
        call_user_func_array(function(Recipient ...$r) {}, $recipients);
0 ignored issues
show
The parameter $r 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

20
        call_user_func_array(function(/** @scrutinizer ignore-unused */ Recipient ...$r) {}, $recipients);

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...
21
22 2
        $this->transactions = $transactions;
23 2
        $this->recipients = $recipients;
24 2
    }
25
26 2
    public function jsonSerialize(): object
27
    {
28 2
        $addresses = [ ];
29
30 2
        foreach ($this->recipients as $recipient) {
31 2
            $addresses = array_merge($addresses, (array) $recipient->jsonSerialize());
32
        }
33
34
        return (object) [
35 2
            'jsonrpc' => Command::JSON_RPC_VERSION,
36
            'id'      => Command::ID,
37 2
            'method'  => self::METHOD,
38 2
            'params' => [ $this->transactions, (object) $addresses ]
39
        ];
40
    }
41
}
42