summaryrefslogtreecommitdiff
path: root/src/Component.php
diff options
context:
space:
mode:
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;
+}