| Total Complexity | 7 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 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 | 2 | public function __construct(array $transactions, array $recipients) |
|
| 18 | { |
||
| 19 | 2 | foreach ($transactions as $t) { |
|
| 20 | 2 | if (!$t instanceof RawTransaction) { |
|
| 21 | 2 | throw new \InvalidArgumentException("Invalid type within RawTransaction array: " . gettype($t)); |
|
| 22 | } |
||
| 23 | } |
||
| 24 | |||
| 25 | 2 | foreach ($recipients as $r) { |
|
| 26 | 2 | if (!$r instanceof Recipient) { |
|
| 27 | 2 | throw new \InvalidArgumentException("Invalid type within Recipient array: " . gettype($r)); |
|
| 28 | } |
||
| 29 | } |
||
| 30 | |||
| 31 | 2 | $this->transactions = $transactions; |
|
| 32 | 2 | $this->recipients = $recipients; |
|
| 33 | 2 | } |
|
| 34 | |||
| 35 | 2 | public function jsonSerialize(): object |
|
| 48 | ]; |
||
| 49 | } |
||
| 51 |