Skip to content

Commit cc369f6

Browse files
committed
- adds visibility to constants
- chore: simplify FQN
1 parent a57d6dd commit cc369f6

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

UUID.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
use function strlen;
3333
use function strtolower;
3434
use function substr;
35+
use function trim;
3536
use function unpack;
3637
use function vsprintf;
3738

@@ -57,28 +58,28 @@ final class UUID
5758
* When this namespace is specified, the name string
5859
* is a fully-qualified domain name.
5960
*/
60-
const NAMESPACE_DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
61+
public const NAMESPACE_DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
6162

6263
/**
6364
* When this namespace is specified, the name string is a URL.
6465
*/
65-
const NAMESPACE_URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
66+
public const NAMESPACE_URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
6667

6768
/**
6869
* When this namespace is specified, the name string is an ISO OID.
6970
*/
70-
const NAMESPACE_OID = '6ba7b812-9dad-11d1-80b4-00c04fd430c8';
71+
public const NAMESPACE_OID = '6ba7b812-9dad-11d1-80b4-00c04fd430c8';
7172

7273
/**
7374
* When this namespace is specified, the name string is
7475
* an X.500 DN in DER or a text output format.
7576
*/
76-
const NAMESPACE_X500 = '6ba7b814-9dad-11d1-80b4-00c04fd430c8';
77+
public const NAMESPACE_X500 = '6ba7b814-9dad-11d1-80b4-00c04fd430c8';
7778

7879
/**
7980
* Regex pattern for UUIDs
8081
*/
81-
const PATTERN = '[a-f0-9]{8}\-[a-f0-9]{4}\-[1|3|4|5][a-f0-9]{3}\-[a-f0-9]{4}\-[a-f0-9]{12}';
82+
public const PATTERN = '[a-f0-9]{8}\-[a-f0-9]{4}\-[1|3|4|5][a-f0-9]{3}\-[a-f0-9]{4}\-[a-f0-9]{12}';
8283

8384
/**
8485
* Generates a UUID based on the MD5 hash of a namespace
@@ -183,7 +184,7 @@ public static function v1(string|int $address = null): string
183184
return $node = vsprintf('%02x%02x%02x%02x', explode('.', $node));
184185
}
185186
if ($node = `hostname 2> /dev/null`) {
186-
$node = gethostbyname(\trim($node));
187+
$node = gethostbyname(trim($node));
187188
return $node = vsprintf('%02x%02x%02x%02x', explode('.', $node));
188189
}
189190
// Cannot identify IP or host, fallback as described in

0 commit comments

Comments
 (0)