Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
75.00% |
3 / 4 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| UserBucketProvider | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| getUserEditCountBucket | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Extension\EventLogging\Libs\UserBucketProvider; |
| 4 | |
| 5 | use MediaWiki\MediaWikiServices; |
| 6 | use MediaWiki\User\UserIdentity; |
| 7 | |
| 8 | /** |
| 9 | * Utilities for getting low-granularity segmentation of users. |
| 10 | */ |
| 11 | class UserBucketProvider { |
| 12 | |
| 13 | /** |
| 14 | * Find the coarse bucket corresponding to a user's edit count. |
| 15 | * |
| 16 | * @see UserBucketService::bucketEditCount() |
| 17 | * @see UserBucketService::getUserEditCountBucket() |
| 18 | * |
| 19 | * @param UserIdentity $user provides raw edit count |
| 20 | * @return string|null Bucket identifier, or null for anonymous users. |
| 21 | * |
| 22 | * @deprecated since 1.40. Use an injected instance of `UserBucketService` or the |
| 23 | * `EventLogging.UserBucketService` service instead |
| 24 | */ |
| 25 | public static function getUserEditCountBucket( UserIdentity $user ): ?string { |
| 26 | return MediaWikiServices::getInstance() |
| 27 | ->getService( 'EventLogging.UserBucketService' ) |
| 28 | ->getUserEditCountBucket( $user ); |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | class_alias( UserBucketProvider::class, 'UserBucketProvider' ); |