34 protected function formatCondition(
string|
int|array $condition ):
string {
35 if ( is_array( $condition ) && count( $condition ) > 0 ) {
36 $condName = array_shift( $condition );
37 if ( in_array( $condName, UserRequirementsConditionChecker::VALID_OPS ) ) {
39 foreach ( $condition as $subcond ) {
40 $listItems .= Html::rawElement(
'li', [], $this->formatCondition( $subcond ) );
42 $htmlList = Html::rawElement(
'ul', [], $listItems );
43 $condName = match ( $condName ) {
44 '&' =>
'listgrouprights-restrictedgroups-op-and',
45 '|' =>
'listgrouprights-restrictedgroups-op-or',
46 '^' =>
'listgrouprights-restrictedgroups-op-xor',
49 '!' =>
'listgrouprights-restrictedgroups-op-nand',
51 return $this->msg( $condName )
52 ->rawParams( $htmlList )
55 return $this->formatAtomicCondition( $condName, $condition );
57 } elseif ( is_array( $condition ) ) {
60 return $this->formatAtomicCondition( $condition, [] );
68 protected function formatAtomicCondition(
string|
int $condName, array $args ):
string {
69 $msgKey = match ( $condName ) {
71 APCOND_AGE =>
'listgrouprights-restrictedgroups-cond-age',
74 APCOND_ISIP =>
'listgrouprights-restrictedgroups-cond-isip',
78 APCOND_ISBOT =>
'listgrouprights-restrictedgroups-cond-isbot',
82 if ( $msgKey ===
null ) {
85 $this->
getHookRunner()->onUserRequirementsConditionDisplay( $condName, $args, $context, $messageSpec );
86 if ( $messageSpec !==
null ) {
87 return $this->msg( $messageSpec )->parse();
89 $msgKey =
'listgrouprights-restrictedgroups-cond-' . $condName;
92 $msg = $this->msg( $msgKey );
96 $msg->durationParams( $minAge );
99 foreach ( $args as $group ) {
100 $groupNames[] = $this->
getLanguage()->getGroupName( $group );
105 $msg->numParams( $minEdits );
107 $msg->params( ...$args );
110 return $msg->parse();