/** * @param array $transaction */ public function __construct(array $transaction) { Utils::checkRequiredFields(self::$REQUIRED, $transaction); if (!empty($transaction['block_time'])) { $transaction['block_time'] = DateTime::createFromFormat(DateTime::ISO8601, $transaction['block_time']); } if (!empty($transaction['chain_received_at'])) { $transaction['chain_received_at'] = DateTime::createFromFormat('Y-m-d\\TH:i:s.uO', $transaction['chain_received_at']); } $inputs = []; foreach ($transaction['inputs'] as $input) { $inputs[] = new TransactionInput($input); } $transaction['inputs'] = $inputs; $outputs = []; foreach ($transaction['outputs'] as $output) { $outputs[] = new TransactionOutput($output); } $transaction['outputs'] = $outputs; $this->transaction = $transaction; }
/** * @param array $notification */ protected function __construct(array $notification) { \Brosland\Chain\Utils::checkRequiredFields(self::$REQUIRED, $notification); $this->notification = $notification; $this->notification['created_at'] = DateTime::createFromFormat(DateTime::ISO8601, $this->notification['created_at']); }
/** * @param array $data */ protected function __construct(array $data) { parent::__construct($data); \Brosland\Chain\Utils::checkRequiredFields(self::$REQUIRED, $data); }
/** * @param array $block */ public function __construct(array $block) { Utils::checkRequiredFields(self::$REQUIRED, $block); $block['time'] = DateTime::createFromFormat('Y-m-d\\TH:i:s.uO', $block['time']); $this->block = $block; }