]> git.mxchange.org Git - friendica.git/blob - src/Util/ACLFormatter.php
4e3d32b157d76aea0a7fb9a820f6f35a8c503fe5
[friendica.git] / src / Util / ACLFormatter.php
1 <?php
2
3 namespace Friendica\Util;
4
5 use Friendica\Model\Group;
6
7 /**
8  * Util class for ACL formatting
9  */
10 final class ACLFormatter
11 {
12         /**
13          * Turn user/group ACLs stored as angle bracketed text into arrays
14          *
15          * @param string $ids A angle-bracketed list of IDs
16          *
17          * @return array The array based on the IDs
18          */
19         public function expand(string $ids)
20         {
21                 // turn string array of angle-bracketed elements into numeric array
22                 // e.g. "<1><2><3>" => array(1,2,3);
23                 preg_match_all('/<(' . Group::FOLLOWERS . '|'. Group::MUTUALS . '|[0-9]+)>/', $ids, $matches, PREG_PATTERN_ORDER);
24
25                 return $matches[1];
26         }
27 }