LogItem.php
2 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
/**
* Aliyun_Log_Models_LogItem used to present a log, it contains log time and multiple
* key/value pairs to present the log contents.
*
* @author log service dev
*/
class Aliyun_Log_Models_LogItem {
/**
* @var integer time of the log item, the default time if the now time.
*/
private $time;
/**
* @var array the data of the log item, including many key/value pairs.
*/
private $contents;
/**
* Aliyun_Log_Models_LogItem cnostructor
*
* @param array $contents
* the data of the log item, including many key/value pairs.
* @param integer $time
* time of the log item, the default time if the now time.
*/
public function __construct($time = null, $contents = null) {
if (! $time)
$time = time ();
$this->time = $time;
if ($contents)
$this->contents = $contents;
else
$this->contents = array ();
}
/**
* Get log time
*
* @return integer log time
*/
public function getTime() {
return $this->time;
}
/**
* Set log time
*
* @param integer $time
* log time
*/
public function setTime($time) {
$this->time = $time;
}
/**
* Get log contents
*
* @return array log contents
*/
public function getContents() {
return $this->contents;
}
/**
* Set log contents
*
* @param array $contents
* log contents
*/
public function setContents($contents) {
$this->contents = $contents;
}
/**
* Add a key/value pair as log content to the log
*
* @param string $key
* log content key
* @param string $value
* log content value
*/
public function pushBack($key, $value) {
$this->contents [$key] = $value;
}
}