Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F4792943
PhabricatorGroupMapping.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorGroupMapping.php
View Options
<?php
namespace
Nasqueron\Notifications\Analyzers\Phabricator
;
use
Nasqueron\Notifications\Phabricator\PhabricatorStory
;
class
PhabricatorGroupMapping
{
///
/// Properties
///
/**
* The group the mapped projects belong to
*
* @var string
*/
public
$group
;
/**
* An array of the projects, each item a string with the name of the
* project. The wildcard '*' is allowed to specify several projects.
*
* @var array
*/
public
$projects
;
/**
* An array of words, each item a string with a word to find in the story.
*
* @var array
*/
public
$words
=
[];
///
/// Helper methods
///
/**
* Determines if the specified project matches a pattern
*
* @param string $pattern The pattern, with * allowed as wildcard character
* @param string $project The project name to compare with the pattern
* @return bool
*/
public
static
function
doesProjectMatch
(
$pattern
,
$project
)
{
return
str_is
(
$pattern
,
$project
);
}
/**
* Determines if the specified project belong to this mapping
*
* @return bool
*/
public
function
doesProjectBelong
(
$actualProject
)
{
foreach
(
$this
->
projects
as
$candidateProject
)
{
if
(
static
::
doesProjectMatch
(
$candidateProject
,
$actualProject
))
{
return
true
;
}
}
return
false
;
}
/**
* Determines if the specified story belong to this mapping
*
* @return bool
*/
public
function
doesStoryBelong
(
PhabricatorStory
$story
)
{
foreach
(
$this
->
words
as
$word
)
{
if
(
stripos
(
$story
->
text
,
$word
)
!==
false
)
{
return
true
;
}
}
return
false
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Feb 28, 21:39 (1 d, 5 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2438133
Default Alt Text
PhabricatorGroupMapping.php (1 KB)
Attached To
Mode
rNOTIF Notifications center
Attached
Detach File
Event Timeline
Log In to Comment