Skip to content

Commit 2f36351

Browse files
minor README edit
1 parent fa9e789 commit 2f36351

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ It provides a 12-byte binary id based on [the specification](https://www.mongodb
2222

2323
#### Create a new ObjectId
2424

25-
When no data is provided, a new unique identifier is generated.
25+
Generate a new unique identifier
2626

2727
~~~php
2828
use SlimeSystems\ObjectId;
@@ -40,7 +40,7 @@ Accepts a binary string of exactly 12 bytes.
4040
$id = ObjectId::fromBinary($raw);
4141
~~~
4242

43-
Invalid lengths (anything other than 12 bytes) will throw `SlimeSystems\ObjectId\Exception\Invalid`.
43+
Invalid binary will throw `SlimeSystems\ObjectId\Exception\Invalid`.
4444

4545
#### From a hex string
4646

@@ -50,7 +50,7 @@ Accepts a 24-character hexadecimal string.
5050
$id = ObjectId::fromString($hex);
5151
~~~
5252

53-
Invalid hex or invalid lengths will throw `SlimeSystems\ObjectId\Exception\Invalid`.
53+
Invalid hex string will throw `SlimeSystems\ObjectId\Exception\Invalid`.
5454

5555
#### From a timestamp
5656

@@ -62,6 +62,8 @@ $id = ObjectId::fromTime($dateTime);
6262
$id = ObjectId::fromTime($timestamp);
6363
~~~
6464

65+
Invalid time will throw `SlimeSystems\ObjectId\Exception\Invalid`.
66+
6567
#### ObjectIds for time comparison
6668

6769
If you need an ObjectId for time comparisons, you can add `unique: false` to zeroes the last 8 bytes out:
@@ -71,6 +73,8 @@ $id = ObjectId::fromTime($time, unique: false);
7173
// Last 8 bytes of the hex string will be "0000000000000000"
7274
~~~
7375

76+
This also do not increase the internal counter for generating a unique identifier.
77+
7478
### Conversions
7579

7680
#### Convert to string
@@ -98,7 +102,7 @@ $time = $id->toTime();
98102

99103
#### Human-readable inspection
100104

101-
`inspect()` returns a more detailed string containing the hex form and extra info.
105+
`inspect()` returns a readable string containing the hex representation.
102106

103107
~~~php
104108
$id->inspect() // return "SlimeSystems\ObjectId(<hexadecimal representation>)"

0 commit comments

Comments
 (0)