diff --git a/include/class-Host.php b/include/class-Host.php index 015f3ec..7803fb5 100644 --- a/include/class-Host.php +++ b/include/class-Host.php @@ -1,110 +1,108 @@ . /** * Methods for a Host class */ trait HostTrait { - use HostTrait; - /** * Get the Host's ID * * @return int */ public function getHostID() { return $this->get( 'host_ID' ); } /** * Get the Host's IPv4 in a numeric expression * * @return int */ public function getHostIPv4Long() { return $this->get( 'host_ipv4' ); } /** * Get the Host's IPv4 in the expected dotted format * * @return string */ public function getHostIPv4() { return long2ip( $this->getHostIPv4Long() ); } /** * Get the host's hostname * * @return string */ public function getHostName() { return $this->get( 'host_hostname' ); } /** * Get the Host's description * * @return string */ public function getHostDescription() { return $this->get( 'host_description' ); } /** * Normalize an Host object */ protected function normalizeHost() { $this->integers( 'host_ID', 'host_ipv4' ); } } /** * Describe the 'host' database table */ class Host extends Queried { use HostTrait; /** * Table name */ const T = 'host'; /** * Constructor */ public function __construct() { $this->normalizeHost(); } /** * Force to get a Host ID, whatever is passed * * @param mixed $host Host object or Host ID * @return int */ public static function getID( $host ) { return is_object( $host ) ? $host->getHostID() : (int)$host; } }