Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F4793845
ItemGroupMapping.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
ItemGroupMapping.php
View Options
<?php
namespace
Nasqueron\Notifications\Analyzers
;
/**
* Map items (repositories, projects, items, etc.) names to groups
*/
class
ItemGroupMapping
{
///
/// Properties
///
/**
* The group the mapped items belong to
*
* @var string
*/
public
$group
;
/**
* An array of the items to map, each item a string with the name of the
* repository, project or item used for mapping.
* The wildcard '*' is allowed to specify several items.
*
* @var array
*/
public
$items
;
///
/// Helper methods
///
/**
* Determines if the specified item matches a pattern.
*
* @param string $pattern The pattern, with * allowed as wildcard character
* @param string $item The item name to compare with the pattern
* @return bool
*/
public
static
function
doesItemMatch
(
$pattern
,
$item
)
{
return
str_is
(
$pattern
,
$item
);
}
/**
* Determines if the specified item belong to this mapping
*
* @return bool
*/
public
function
doesItemBelong
(
$actualItem
)
{
foreach
(
$this
->
items
as
$candidateItem
)
{
if
(
static
::
doesItemMatch
(
$candidateItem
,
$actualItem
))
{
return
true
;
}
}
return
false
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Feb 28, 22:47 (23 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2438558
Default Alt Text
ItemGroupMapping.php (1 KB)
Attached To
Mode
rNOTIF Notifications center
Attached
Detach File
Event Timeline
Log In to Comment