Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93190123
PhrequentTimeSlices.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Nov 26, 21:41
Size
767 B
Mime Type
text/x-php
Expires
Thu, Nov 28, 21:41 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22590681
Attached To
rPH Phabricator
PhrequentTimeSlices.php
View Options
<?php
final
class
PhrequentTimeSlices
extends
Phobject
{
private
$objectPHID
;
private
$isOngoing
;
private
$ranges
;
public
function
__construct
(
$object_phid
,
$is_ongoing
,
array
$ranges
)
{
$this
->
objectPHID
=
$object_phid
;
$this
->
isOngoing
=
$is_ongoing
;
$this
->
ranges
=
$ranges
;
}
public
function
getObjectPHID
()
{
return
$this
->
objectPHID
;
}
public
function
getDuration
(
$now
)
{
$total
=
0
;
foreach
(
$this
->
ranges
as
$range
)
{
if
(
$range
[
1
]
===
null
)
{
$total
+=
$now
-
$range
[
0
];
}
else
{
$total
+=
$range
[
1
]
-
$range
[
0
];
}
}
return
$total
;
}
public
function
getIsOngoing
()
{
return
$this
->
isOngoing
;
}
public
function
getRanges
()
{
return
$this
->
ranges
;
}
}
Event Timeline
Log In to Comment