Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/3rdparty.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mlocati/ip-lib/src/Address/Type.php')
-rw-r--r--mlocati/ip-lib/src/Address/Type.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/mlocati/ip-lib/src/Address/Type.php b/mlocati/ip-lib/src/Address/Type.php
new file mode 100644
index 00000000..17488f38
--- /dev/null
+++ b/mlocati/ip-lib/src/Address/Type.php
@@ -0,0 +1,44 @@
+<?php
+
+namespace IPLib\Address;
+
+/**
+ * Types of IP addresses.
+ */
+class Type
+{
+ /**
+ * IPv4 address.
+ *
+ * @var int
+ */
+ const T_IPv4 = 4;
+
+ /**
+ * IPv6 address.
+ *
+ * @var int
+ */
+ const T_IPv6 = 6;
+
+ /**
+ * Get the name of a type.
+ *
+ * @param int $type
+ *
+ * @return string
+ *
+ * @since 1.1.0
+ */
+ public static function getName($type)
+ {
+ switch ($type) {
+ case static::T_IPv4:
+ return 'IP v4';
+ case static::T_IPv6:
+ return 'IP v6';
+ default:
+ return sprintf('Unknown type (%s)', $type);
+ }
+ }
+}