@@ -120,25 +120,11 @@ public function countEntries(string $filter, string $type): int {
120120 return (int )$ result ;
121121 }
122122
123- /**
124- * formats the return value of a count operation to the string to be
125- * inserted.
126- *
127- * @param int $count
128- * @return string
129- */
130- private function formatCountResult (int $ count ): string {
131- if ($ count > 1000 ) {
132- return '> 1000 ' ;
133- }
134- return (string )$ count ;
135- }
136-
137123 public function countGroups () {
138124 $ filter = $ this ->configuration ->ldapGroupFilter ;
139125
140126 if (empty ($ filter )) {
141- $ output = self ::$ l ->n ('%s group found ' , '%s groups found ' , 0 , [ 0 ] );
127+ $ output = self ::$ l ->n ('%n group found ' , '%n groups found ' , 0 );
142128 $ this ->result ->addChange ('ldap_group_count ' , $ output );
143129 return $ this ->result ;
144130 }
@@ -152,12 +138,16 @@ public function countGroups() {
152138 }
153139 return false ;
154140 }
155- $ output = self ::$ l ->n (
156- '%s group found ' ,
157- '%s groups found ' ,
158- $ groupsTotal ,
159- [$ this ->formatCountResult ($ groupsTotal )]
160- );
141+
142+ if ($ groupsTotal > 1000 ) {
143+ $ output = self ::$ l ->t ('> 1000 groups found ' );
144+ } else {
145+ $ output = self ::$ l ->n (
146+ '%n group found ' ,
147+ '%n groups found ' ,
148+ $ groupsTotal
149+ );
150+ }
161151 $ this ->result ->addChange ('ldap_group_count ' , $ output );
162152 return $ this ->result ;
163153 }
@@ -170,12 +160,15 @@ public function countUsers() {
170160 $ filter = $ this ->access ->getFilterForUserCount ();
171161
172162 $ usersTotal = $ this ->countEntries ($ filter , 'users ' );
173- $ output = self ::$ l ->n (
174- '%s user found ' ,
175- '%s users found ' ,
176- $ usersTotal ,
177- [$ this ->formatCountResult ($ usersTotal )]
178- );
163+ if ($ usersTotal > 1000 ) {
164+ $ output = self ::$ l ->t ('> 1000 users found ' );
165+ } else {
166+ $ output = self ::$ l ->n (
167+ '%n user found ' ,
168+ '%n users found ' ,
169+ $ usersTotal
170+ );
171+ }
179172 $ this ->result ->addChange ('ldap_user_count ' , $ output );
180173 return $ this ->result ;
181174 }
0 commit comments