-
Notifications
You must be signed in to change notification settings - Fork 0
/
FritzLog.php
60 lines (55 loc) · 1 KB
/
FritzLog.php
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
<?
class FritzLog
{
public $Log;
private $_tz;
private $_offset;
public function __construct(string $tzname)
{
$this->_tz = $tzname;
$this->Log = array();
$this->_offset=0;
}
public function tz() : string
{
return $this->_tz;
}
public function offset() : int
{
return $this->_offset;
}
public function setOffset(int $value)
{
return $this->_offset = $value;
}
public function add(DateTime $ts, string $category, int $id, string $message)
{
array_push($this->Log, new FritzLogEvent($this, $ts, $category, $id, $message));
}
public function getTimeStamps()
{
$last_ts = array();
if (count((array)$this->Log)>0)
{
foreach ((array)$this->Log as $row)
{
$ts = (int)$row->ts();
if($ts<>$prev_ts)
{
array_push($last_ts, $ts);
$prev_ts = $ts;
$valsw=$valsw+1;
}
else
{
array_push($last_ts, $prev_ts);
}
if ($valsw==$limit) break;
}
}
foreach($last_ts as $ts)
{echo ($ts).PHP_EOL;}
return $last_ts;
}
}
?>