/**
  * @param Transaction|null $transaction
  * @param TransactionListItem $transactionListItem
  * @param string $apiUrl
  * @param string $explorerUrl
  * @return $this
  */
 public static function from($transaction, TransactionListItem $transactionListItem, $apiUrl, $explorerUrl)
 {
     $transactionListItemDto = new self();
     // From local app transaction
     if ($transaction !== null) {
         $transactionListItemDto->setDescription($transaction->getDescription());
     } else {
         $transactionListItemDto->setDescription($transactionListItem->getTxHash());
     }
     // From BlockCypher TXRef
     $transactionListItemDto->setTxHash($transactionListItem->getTxHash());
     //$transactionListItemDto->setTxInputN($transactionListItem->getTxInputN());
     //$transactionListItemDto->setValue($transactionListItem->getValue());
     $transactionListItemDto->setConfirmations($transactionListItem->getConfirmations());
     if ($transactionListItem->getReceived() !== null) {
         $transactionListItemDto->setReceived($transactionListItem->getReceived());
     }
     if ($transactionListItem->getConfirmed() !== null) {
         $transactionListItemDto->setConfirmed($transactionListItem->getConfirmed());
     }
     $transactionListItemDto->setBlockHeight($transactionListItem->getBlockHeight());
     $transactionListItemDto->setTotal($transactionListItem->getFinalTotal());
     $transactionListItemDto->setApiUrl($apiUrl);
     $transactionListItemDto->setExplorerUrl($explorerUrl);
     return $transactionListItemDto;
 }
 /**
  * @param BlockCypherTXRef[] $blockCypherTXRefs
  * @return TransactionListItem[]
  */
 public static function from($blockCypherTXRefs)
 {
     /** @var TransactionListItem[] $transactionListItems */
     $transactionListItems = array();
     if (!is_array($blockCypherTXRefs)) {
         return $transactionListItems;
     }
     /** @var BlockCypherTXRef $blockCypherTXRef */
     foreach ($blockCypherTXRefs as $blockCypherTXRef) {
         $txHash = $blockCypherTXRef->getTxHash();
         // Create new TransactionListItem if it does not exist.
         if (!isset($transactionListItems[$txHash])) {
             $transactionListItem = TransactionListItem::from($blockCypherTXRef);
             $transactionListItems[$txHash] = $transactionListItem;
         } else {
             $transactionListItem = $transactionListItems[$txHash];
         }
         // Increment totals
         if ($blockCypherTXRef->getTxInputN() >= 0) {
             // TXRef is an Input
             $transactionListItem->incrementInputsTotal($blockCypherTXRef->getValue());
         } else {
             // TXRef is an Output
             $transactionListItem->incrementOutputsTotal($blockCypherTXRef->getValue());
         }
     }
     return $transactionListItems;
 }