Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F982967
ReleephRequestEvent.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
ReleephRequestEvent.php
View Options
<?php
final
class
ReleephRequestEvent
extends
ReleephDAO
{
const
TYPE_CREATE
=
'create'
;
const
TYPE_STATUS
=
'status'
;
// old events
const
TYPE_USER_INTENT
=
'user-intent'
;
const
TYPE_PICK_STATUS
=
'pick-status'
;
const
TYPE_COMMIT
=
'commit'
;
const
TYPE_MANUAL_ACTION
=
'manual-action'
;
const
TYPE_DISCOVERY
=
'discovery'
;
const
TYPE_COMMENT
=
'comment'
;
protected
$releephRequestID
;
protected
$type
;
protected
$actorPHID
;
protected
$details
=
array
();
public
function
getConfiguration
()
{
return
array
(
self
::
CONFIG_SERIALIZATION
=>
array
(
'details'
=>
self
::
SERIALIZATION_JSON
,
),
)
+
parent
::
getConfiguration
();
}
public
function
getDetail
(
$key
,
$default
=
null
)
{
return
idx
(
$this
->
details
,
$key
,
$default
);
}
public
function
setDetail
(
$key
,
$value
)
{
$this
->
details
[
$key
]
=
$value
;
return
$this
;
}
private
function
setDetails
(
array
$details
)
{
throw
new
Exception
(
'Use setDetail()!'
);
}
public
function
setStatusBefore
(
$status
)
{
return
$this
->
setDetail
(
'oldStatus'
,
$status
);
}
public
function
setStatusAfter
(
$status
)
{
return
$this
->
setDetail
(
'newStatus'
,
$status
);
}
public
function
getStatusBefore
()
{
return
$this
->
getDetail
(
'oldStatus'
);
}
public
function
getStatusAfter
()
{
return
$this
->
getDetail
(
'newStatus'
);
}
public
function
getComment
()
{
return
$this
->
getDetail
(
'comment'
);
}
public
function
extractPHIDs
()
{
$phids
=
array
();
$phids
[]
=
$this
->
actorPHID
;
foreach
(
$this
->
details
as
$key
=>
$value
)
{
if
(
strpos
(
$key
,
'PHID'
)
!==
false
||
strpos
(
$key
,
'phid'
)
!==
false
)
{
$phids
[]
=
$value
;
}
}
return
$phids
;
}
public
function
canGroupWith
(
ReleephRequestEvent
$next
)
{
if
(
$this
->
getActorPHID
()
!=
$next
->
getActorPHID
())
{
return
false
;
}
if
(
$this
->
getComment
()
&&
$next
->
getComment
())
{
return
false
;
}
// Break the chain if the next event changes the status
if
(
$next
->
getStatusBefore
()
!=
$next
->
getStatusAfter
())
{
return
false
;
}
// Don't group if the next event starts off with a different status to the
// one we ended with. This probably shouldn't ever happen.
if
(
$this
->
getStatusAfter
()
!=
$next
->
getStatusBefore
())
{
return
false
;
}
return
true
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Jun 18, 2:01 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
236650
Default Alt Text
ReleephRequestEvent.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment