Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100317793
PhabricatorPeopleMailEngine.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
Wed, Jan 29, 22:12
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Jan 31, 22:12 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23948889
Attached To
rPH Phabricator
PhabricatorPeopleMailEngine.php
View Options
<?php
abstract
class
PhabricatorPeopleMailEngine
extends
Phobject
{
private
$sender
;
private
$recipient
;
final
public
function
setSender
(
PhabricatorUser
$sender
)
{
$this
->
sender
=
$sender
;
return
$this
;
}
final
public
function
getSender
()
{
if
(!
$this
->
sender
)
{
throw
new
PhutilInvalidStateException
(
'setSender'
);
}
return
$this
->
sender
;
}
final
public
function
setRecipient
(
PhabricatorUser
$recipient
)
{
$this
->
recipient
=
$recipient
;
return
$this
;
}
final
public
function
getRecipient
()
{
if
(!
$this
->
recipient
)
{
throw
new
PhutilInvalidStateException
(
'setRecipient'
);
}
return
$this
->
recipient
;
}
final
public
function
canSendMail
()
{
try
{
$this
->
validateMail
();
return
true
;
}
catch
(
PhabricatorPeopleMailEngineException
$ex
)
{
return
false
;
}
}
final
public
function
sendMail
()
{
$this
->
validateMail
();
$mail
=
$this
->
newMail
();
$mail
->
setForceDelivery
(
true
)
->
save
();
return
$mail
;
}
abstract
public
function
validateMail
();
abstract
protected
function
newMail
();
final
protected
function
throwValidationException
(
$title
,
$body
)
{
throw
new
PhabricatorPeopleMailEngineException
(
$title
,
$body
);
}
final
protected
function
newRemarkupText
(
$text
)
{
$recipient
=
$this
->
getRecipient
();
$engine
=
PhabricatorMarkupEngine
::
newMarkupEngine
(
array
())
->
setConfig
(
'viewer'
,
$recipient
)
->
setConfig
(
'uri.base'
,
PhabricatorEnv
::
getProductionURI
(
'/'
))
->
setMode
(
PhutilRemarkupEngine
::
MODE_TEXT
);
return
$engine
->
markupText
(
$text
);
}
}
Event Timeline
Log In to Comment