1<?php 2 3namespace IPLib\Address; 4 5/** 6 * Types of IP addresses. 7 */ 8class Type 9{ 10 /** 11 * IPv4 address. 12 * 13 * @var int 14 */ 15 const T_IPv4 = 4; 16 17 /** 18 * IPv6 address. 19 * 20 * @var int 21 */ 22 const T_IPv6 = 6; 23 24 /** 25 * Get the name of a type. 26 * 27 * @param int $type 28 * 29 * @return string 30 */ 31 public static function getName($type) 32 { 33 switch ($type) { 34 case static::T_IPv4: 35 return 'IP v4'; 36 case static::T_IPv6: 37 return 'IP v6'; 38 default: 39 return sprintf('Unknown type (%s)', $type); 40 } 41 } 42} 43