Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
namespace Monero;
class Transaction
{
public $amount;
public $timeReceived;
public $time;
public $address;
public $id;
public $confirmations;
public $payment_id;
public $block_height;
/**
* Transaction constructor.
*
* @param $id
* @param $amount
* @param $address
* @param $confirmations
* @param $time
* @param $timeReceived
* @param $paymentId
*/
public function __construct($id, $amount, $address, $confirmations, $time, $timeReceived, $paymentId = null, $blockheight = null)
{
$this->amount = $amount;
$this->time_received = $timeReceived;
$this->time = $time;
$this->address = $address;
$this->id = $id;
$this->confirmations = $confirmations;
$this->payment_id = $paymentId;
$this->block_height = $blockheight;
$this->correctTimeRecieved();
}
/**
* Adds a time recieved if we did not get one. its a fix for some coins
*
* @param $tx_time_received
* @param $tx_time
*
* @return int
*/
protected function correctTimeRecieved()
{
if (isset($this->time_received) && $this->time_received != null) { //fix for coins that only have time but no time_received
$timereceived = $this->time_received;
} else {
$timereceived = $this->time;
}
$this->time_received = $timereceived;
}
}