File tree 6 files changed +30
-30
lines changed
6 files changed +30
-30
lines changed Original file line number Diff line number Diff line change 1
- # Shoperti Ciud
1
+ # Shoperti Cuid
Original file line number Diff line number Diff line change 1
1
{
2
- "name" : " shoperti/ciud " ,
2
+ "name" : " shoperti/cuid " ,
3
3
"description" : " Collision-resistant ids optimized for horizontal scaling and performance." ,
4
4
"license" : " MIT" ,
5
5
"keywords" : [
6
- " ciud " ,
6
+ " cuid " ,
7
7
" shoperti" ,
8
8
" php"
9
9
],
15
15
},
16
16
"autoload" : {
17
17
"psr-4" : {
18
- "Shoperti\\ Ciud \\ " : " src/"
18
+ "Shoperti\\ Cuid \\ " : " src/"
19
19
}
20
20
},
21
21
"autoload-dev" : {
22
22
"psr-4" : {
23
- "Shoperti\\ Tests\\ Ciud \\ " : " tests/"
23
+ "Shoperti\\ Tests\\ Cuid \\ " : " tests/"
24
24
}
25
25
},
26
26
"extra" : {
Original file line number Diff line number Diff line change 14
14
verbose =" true"
15
15
>
16
16
<testsuites >
17
- <testsuite name =" Shoperti Ciud Test Suite" >
17
+ <testsuite name =" Shoperti Cuid Test Suite" >
18
18
<directory suffix =" Test.php" >./tests</directory >
19
19
</testsuite >
20
20
</testsuites >
Original file line number Diff line number Diff line change 9
9
* file that was distributed with this source code.
10
10
*/
11
11
12
- namespace Shoperti \Ciud ;
12
+ namespace Shoperti \Cuid ;
13
13
14
14
/**
15
- * This is the Ciud class.
15
+ * This is the Cuid class.
16
16
*
17
17
* @author Joseph Cohen <[email protected] >
18
18
*/
19
- class Ciud
19
+ class Cuid
20
20
{
21
21
/**
22
22
* The factory to use when creating UUIDs.
23
23
*
24
- * @var \Shoperti\Ciud\CiudFactory
24
+ * @var \Shoperti\Cuid\CuidFactory
25
25
*/
26
26
private static $ factory = null ;
27
27
28
28
/**
29
- * Returns the currently set factory used to create Ciuds .
29
+ * Returns the currently set factory used to create Cuids .
30
30
*
31
- * @return \Shoperti\Ciud\CiudFactory
31
+ * @return \Shoperti\Cuid\CuidFactory
32
32
*/
33
33
public static function getFactory ()
34
34
{
35
35
if (!self ::$ factory ) {
36
- self ::$ factory = new CiudFactory ();
36
+ self ::$ factory = new CuidFactory ();
37
37
}
38
38
39
39
return self ::$ factory ;
40
40
}
41
41
42
42
/**
43
- * Generates a new ciud .
43
+ * Generates a new Cuid .
44
44
*
45
45
* @param string|null $prefix
46
46
*
47
47
* @return string
48
48
*/
49
- public static function ciud ($ prefix = null )
49
+ public static function Cuid ($ prefix = null )
50
50
{
51
- return static ::getFactory ()->ciud ($ prefix );
51
+ return static ::getFactory ()->Cuid ($ prefix );
52
52
}
53
53
54
54
/**
Original file line number Diff line number Diff line change 9
9
* file that was distributed with this source code.
10
10
*/
11
11
12
- namespace Shoperti \Ciud ;
12
+ namespace Shoperti \Cuid ;
13
13
14
14
/**
15
- * This is the Ciud class.
15
+ * This is the Cuid class.
16
16
*
17
17
* @author Joseph Cohen <[email protected] >
18
18
*/
19
- class CiudFactory
19
+ class CuidFactory
20
20
{
21
21
/**
22
22
* The base string constant.
@@ -47,7 +47,7 @@ class CiudFactory
47
47
private $ discreteValues ;
48
48
49
49
/**
50
- * Creates a new ciud factory instance.
50
+ * Creates a new Cuid factory instance.
51
51
*
52
52
* @return void
53
53
*/
@@ -145,13 +145,13 @@ protected function fingerprint()
145
145
}
146
146
147
147
/**
148
- * Generates a new ciud .
148
+ * Generates a new Cuid .
149
149
*
150
150
* @param string|null $prefix
151
151
*
152
152
* @return string
153
153
*/
154
- public function ciud ($ prefix = null )
154
+ public function Cuid ($ prefix = null )
155
155
{
156
156
// Starting with a lowercase letter makes
157
157
// it HTML element ID friendly.
Original file line number Diff line number Diff line change 9
9
* file that was distributed with this source code.
10
10
*/
11
11
12
- namespace Shoperti \Tests \Ciud ;
12
+ namespace Shoperti \Tests \Cuid ;
13
13
14
- use Shoperti \Ciud \ Ciud ;
14
+ use Shoperti \Cuid \ Cuid ;
15
15
16
16
/**
17
- * This is the Ciud test class.
17
+ * This is the Cuid test class.
18
18
*
19
19
* @author Joseph Cohen <[email protected] >
20
20
*/
21
- class CiudTest extends \PHPUnit_Framework_TestCase
21
+ class CuidTest extends \PHPUnit_Framework_TestCase
22
22
{
23
23
const MAX = 100000 ;
24
24
25
25
/** @test */
26
26
function it_shoud_return_string ()
27
27
{
28
- $ ciud = Ciud:: ciud ();
28
+ $ Cuid = Cuid:: Cuid ();
29
29
30
- $ this ->assertInternalType ('string ' , $ ciud );
30
+ $ this ->assertInternalType ('string ' , $ Cuid );
31
31
}
32
32
33
33
/** @test */
@@ -38,7 +38,7 @@ function it_should_not_collide()
38
38
$ pass = true ;
39
39
40
40
while ($ i < self ::MAX ) {
41
- $ id = Ciud:: ciud ();
41
+ $ id = Cuid:: Cuid ();
42
42
43
43
if (!isset ($ ids [$ id ])) {
44
44
$ ids [$ id ] = $ id ;
@@ -61,7 +61,7 @@ function it_should_not_collide_making_slug()
61
61
$ pass = true ;
62
62
63
63
while ($ i < self ::MAX ) {
64
- $ id = Ciud ::slug ();
64
+ $ id = Cuid ::slug ();
65
65
66
66
if (!isset ($ ids [$ id ])) {
67
67
$ ids [$ id ] = $ id ;
You can’t perform that action at this time.
0 commit comments