summaryrefslogtreecommitdiff
path: root/src/Component.php
diff options
context:
space:
mode:
authorZhineng Li <[email protected]>2026-01-05 16:26:11 +0800
committerZhineng Li <[email protected]>2026-01-05 16:26:11 +0800
commita49763dd739c3c68c4a8322896d594e926ac8e6b (patch)
treeab96cf55ccf828ec3c61d7cf5c440cc8fe837a9b /src/Component.php
first commit
Diffstat (limited to 'src/Component.php')
-rw-r--r--src/Component.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/Component.php b/src/Component.php
new file mode 100644
index 0000000..67cf96a
--- /dev/null
+++ b/src/Component.php
@@ -0,0 +1,33 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Zhineng\Snowflake;
+
+interface Component
+{
+ /**
+ * The bit size.
+ */
+ public function bits(): int;
+
+ /**
+ * The component value.
+ */
+ public function value(): int;
+
+ /**
+ * The maximum value based on the number of bits.
+ */
+ public function maxValue(): int;
+
+ /**
+ * Set the bit offset.
+ */
+ public function setOffset(int $offset): Component;
+
+ /**
+ * The bit offset.
+ */
+ public function offset(): int;
+}