File tree 3 files changed +9
-9
lines changed
3 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -29,15 +29,15 @@ class IdProvider {
29
29
* @var callable Function to decide if string ID already exists, i.e. is already used as a
30
30
* WikiPage
31
31
*/
32
- private $ isUniqueId ;
32
+ private $ getUniqueIdChecker ;
33
33
34
34
/**
35
35
* @param $generator
36
- * @param null $isUniqueId
36
+ * @param null $getUniqueIdChecker
37
37
*/
38
- public function __construct ( $ generator , $ isUniqueId = null ) {
38
+ public function __construct ( $ generator , $ getUniqueIdChecker = null ) {
39
39
$ this ->generator = $ generator ;
40
- $ this ->isUniqueId = $ isUniqueId ;
40
+ $ this ->getUniqueIdChecker = $ getUniqueIdChecker ;
41
41
}
42
42
43
43
public function getId ( array $ params = [] ): string {
@@ -47,7 +47,7 @@ public function getId( array $params = [] ): string {
47
47
$ prefix = trim ( $ prefix );
48
48
$ id = $ prefix . $ this ->generator ->generate ();
49
49
if ( !$ skipUniqueTest ) {
50
- while ( !( $ this ->isUniqueId )( $ id ) ) {
50
+ while ( !( $ this ->getUniqueIdChecker )( $ id ) ) {
51
51
$ id = $ prefix . $ this ->generator ->generate ();
52
52
}
53
53
}
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ public static function random( array $params = [] ) {
39
39
}
40
40
41
41
private static function provider ( $ generator ) {
42
- return new IdProvider ( $ generator , self ::isUniqueId () );
42
+ return new IdProvider ( $ generator , self ::getUniqueIdChecker () );
43
43
}
44
44
45
45
private static function dbExecute () {
@@ -65,7 +65,7 @@ private static function dbExecute() {
65
65
* @param string $text The title or ID to check for uniqueness of the wiki page.
66
66
* @return \Closure
67
67
*/
68
- private static function isUniqueId () {
68
+ private static function getUniqueIdChecker () {
69
69
return function ( $ text ) {
70
70
$ title = Title::newFromText ( $ text );
71
71
Original file line number Diff line number Diff line change @@ -51,9 +51,9 @@ public function testIncrementCreatesIncrementIdGenerator() {
51
51
$ this ->assertEquals ( IncrementIdGenerator::class, $ provider ->generatorClass () );
52
52
}
53
53
54
- public function testIsUniqueId () {
54
+ public function testGetUniqueIdChecker () {
55
55
// Call the private method using Reflection
56
- $ reflection = new \ReflectionMethod ( IdProviderFactory::class, 'isUniqueId ' );
56
+ $ reflection = new \ReflectionMethod ( IdProviderFactory::class, 'getUniqueIdChecker ' );
57
57
$ reflection ->setAccessible ( true );
58
58
$ isUniqueClosure = $ reflection ->invoke ( null );
59
59
You can’t perform that action at this time.
0 commit comments