13 protected const PATTERN_USER =
'/\[user\s*=\s*([^\]]*)\](.+?)\[\/user\]/is' . BX_UTF_PCRE_MODIFIER;
14 protected const PATTERN_PROJECT =
'/\[project\s*=\s*([^\]]*)\](.+?)\[\/project\]/is' . BX_UTF_PCRE_MODIFIER;
15 protected const PATTERN_DEPARTMENT =
'/\[department\s*=\s*([^\]]*)\](.+?)\[\/department\]/is' . BX_UTF_PCRE_MODIFIER;
32 public static function getUserIds(
string $text =
''): array
35 return array_map(
function($item) {
return $item[
'ID']; }, $usersData);
44 public static function getUsers(
string $text =
''): array
52 return array_map(
function($item) {
return $item[
'ID']; }, $projectsData);
63 return array_map(
function($item) {
return $item[
'ID']; }, $departmentsData);
71 protected static function getEntitiesList(
string $text =
'',
string $pattern =
''): array
74 preg_match_all($pattern, $text, $matches);
81 foreach($matches[1] as $key => $userId)
85 'NAME' => $matches[2][$key],
98 public static function clear(
string $text =
''): string
102 foreach (self::getPatternsList() as $pattern)
104 $result = preg_replace(
static getUsers(string $text='')
static getDepartmentIds(string $text='')
static getUserIds(string $text='')
static clear(string $text='')
static getDepartments(string $text='')
static getProjects(string $text='')
static getProjectIds(string $text='')
static getEntitiesList(string $text='', string $pattern='')