Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P1944
A not quite right idea
Active
Public
Actions
Authored by
yelirekim
on Feb 16 2016, 1:38 AM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F1113477: A not quite right idea
Feb 16 2016, 1:38 AM
2016-02-16 01:38:58 (UTC+0)
Subscribers
None
<?php
/**
* Exposes a very basic API for reacting to application transactions. Subclasses can override
* @{method:getProcessableTransactionTemplates} or @{method:canProcessTransaction} dending on
* how finely they would like to filter transactions for processing.
*/
abstract
class
CITransactionProcessor
extends
Phobject
{
abstract
public
function
getProcessableTransactionClasses
();
public
function
canProcessTransaction
(
PhabricatorApplicationTransaction
$transaction
)
{
return
in_array
(
get_class
(
$transaction
),
$this
->
getProcessableTransactionClasses
());
}
abstract
protected
function
processTransaction
(
PhabricatorApplicationTransaction
$transaction
);
public
function
processTransactions
(
array
$transactions
)
{
$results
=
[];
foreach
(
$transactions
as
$transaction
)
{
$results
[
$transaction
->
getPHID
()]
=
$this
->
processTransaction
(
$transaction
);
}
return
$results
;
}
public
function
isEnabled
()
{
return
true
;
}
final
public
static
function
getAllProcessors
()
{
$processors
=
(
new
PhutilClassMapQuery
())
->
setAncestorClass
(
__CLASS__
)
->
setFilterMethod
(
'isEnabled'
)
->
execute
();
return
$processors
;
}
}
Event Timeline
yelirekim
created this paste.
Feb 16 2016, 1:38 AM
2016-02-16 01:38:58 (UTC+0)
Log In to Comment