Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100717727
MetaMTAEmailTransactionCommand.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
Sun, Feb 2, 04:02
Size
2 KB
Mime Type
text/x-php
Expires
Tue, Feb 4, 04:02 (2 d)
Engine
blob
Format
Raw Data
Handle
24017857
Attached To
rPH Phabricator
MetaMTAEmailTransactionCommand.php
View Options
<?php
abstract
class
MetaMTAEmailTransactionCommand
extends
Phobject
{
abstract
public
function
getCommand
();
abstract
public
function
isCommandSupportedForObject
(
PhabricatorApplicationTransactionInterface
$object
);
abstract
public
function
buildTransactions
(
PhabricatorUser
$viewer
,
PhabricatorApplicationTransactionInterface
$object
,
PhabricatorMetaMTAReceivedMail
$mail
,
$command
,
array
$argv
);
public
function
getCommandAliases
()
{
return
array
();
}
public
function
getCommandObjects
()
{
return
array
(
$this
);
}
public
static
function
getAllCommands
()
{
static
$commands
;
if
(
$commands
===
null
)
{
$kinds
=
id
(
new
PhutilSymbolLoader
())
->
setAncestorClass
(
__CLASS__
)
->
loadObjects
();
$commands
=
array
();
foreach
(
$kinds
as
$kind
)
{
foreach
(
$kind
->
getCommandObjects
()
as
$command
)
{
$commands
[]
=
$command
;
}
}
}
return
$commands
;
}
public
static
function
getAllCommandsForObject
(
PhabricatorApplicationTransactionInterface
$object
)
{
$commands
=
self
::
getAllCommands
();
foreach
(
$commands
as
$key
=>
$command
)
{
if
(!
$command
->
isCommandSupportedForObject
(
$object
))
{
unset
(
$commands
[
$key
]);
}
}
return
$commands
;
}
public
static
function
getCommandMap
(
array
$commands
)
{
assert_instances_of
(
$commands
,
'MetaMTAEmailTransactionCommand'
);
$map
=
array
();
foreach
(
$commands
as
$command
)
{
$keywords
=
$command
->
getCommandAliases
();
$keywords
[]
=
$command
->
getCommand
();
foreach
(
$keywords
as
$keyword
)
{
$keyword
=
phutil_utf8_strtolower
(
$keyword
);
if
(
empty
(
$map
[
$keyword
]))
{
$map
[
$keyword
]
=
$command
;
}
else
{
throw
new
Exception
(
pht
(
'Mail commands "%s" and "%s" both respond to keyword "%s". '
.
'Keywords must be uniquely associated with commands.'
,
get_class
(
$command
),
get_class
(
$map
[
$keyword
]),
$keyword
));
}
}
}
return
$map
;
}
}
Event Timeline
Log In to Comment