Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22415043
PhutilProgressSink.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
PhutilProgressSink.php
View Options
<?php
abstract
class
PhutilProgressSink
extends
Phobject
{
private
$isRunning
;
private
$totalWork
;
private
$completedWork
;
public
function
__construct
()
{
$this
->
isRunning
=
true
;
}
public
function
__destruct
()
{
if
(
$this
->
isRunning
)
{
$this
->
didFailWork
();
}
}
final
public
function
setTotalWork
(
$total_work
)
{
$this
->
totalWork
=
$total_work
;
return
$this
;
}
final
public
function
getTotalWork
()
{
return
$this
->
totalWork
;
}
final
public
function
getCompletedWork
()
{
return
$this
->
completedWork
;
}
final
public
function
didMakeProgress
(
$amount
=
1
)
{
if
(
$this
->
isRunning
)
{
$this
->
completedWork
+=
$amount
;
$this
->
publishProgress
();
}
}
final
public
function
didCompleteWork
()
{
$this
->
isRunning
=
false
;
$this
->
publishCompletion
();
}
final
public
function
didFailWork
()
{
$this
->
isRunning
=
false
;
$this
->
publishFailure
();
}
abstract
protected
function
publishProgress
();
abstract
protected
function
publishCompletion
();
abstract
protected
function
publishFailure
();
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Nov 28, 01:23 (14 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1216845
Default Alt Text
PhutilProgressSink.php (1 KB)
Attached To
Mode
R118 Arcanist - fork
Attached
Detach File
Event Timeline