Overview

Namespaces

  • Composer
    • Autoload
  • Geekwright
    • RegDom
  • League
    • OAuth2
      • Client
        • Provider
  • None
  • Xmf
    • Database
    • Jwt
    • Key
    • Module
      • Helper

Classes

  • Assert
  • Debug
  • FilterInput
  • Highlighter
  • IPAddress
  • Language
  • Metagen
  • Random
  • Request
  • StopWords
  • Yaml
  • Overview
  • Namespace
  • Class
  • Tree

Class IPAddress

Language

Namespace: Xmf
Package: Xmf
Category: Xmf\IPAddress
Copyright: 2016 XOOPS Project (http://xoops.org)
License: GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
Author: trabis lusopoemas@gmail.com
Link: http://xoops.org
Located at lass/libraries/vendor/xoops/xmf/src/Xmf/IPAddress.php
Methods summary
public
# __construct( string $ip )

IPAddress constructor.

IPAddress constructor.

Parameters

$ip
IP address
public static Xmf\IPAddress
# fromRequest( )

Get IP address from the request server data

Get IP address from the request server data

Returns

Xmf\IPAddress
protected string|false
# normalize( string $ip )

convert IP address into a normalized condensed notation

convert IP address into a normalized condensed notation

Parameters

$ip
ip address to normalize

Returns

string|false
normalized address or false on failure
public string|false
# asReadable( )

return presentation form of address

return presentation form of address

Returns

string|false
public string|false
# asBinary( )

get network (binary) form of address

get network (binary) form of address

Returns

string|false
public integer|false
# ipVersion( )

get the ip version, 4 or 6, of address

get the ip version, 4 or 6, of address

Returns

integer|false
integer 4 for IPV4, 6 for IPV6, or false if invalid
public boolean
# sameSubnet( string $matchIp, integer $netMask4, integer $netMask6 )

Is this IP in the same subnet as the supplied address?

Is this IP in the same subnet as the supplied address?

Accepts net masks for both IPV4 and IPV6 and will select the appropriate one, to allow checking policy against request input with minimal method calls.

Parameters

$matchIp
presentation form ip address to compare
$netMask4
network mask, bits to match <= 32 for IPV4
$netMask6
network mask, bits to match <=128 for IPV6

Returns

boolean
true if $this->ip and $matchIp are both in the specified subnet
protected string
# asBinaryString( Xmf\IPAddress $ip )

Convert an IP address to a binary character string (i.e. "01111111000000000000000000000001")

Convert an IP address to a binary character string (i.e. "01111111000000000000000000000001")

Parameters

$ip
address object

Returns

string
Properties summary
protected false|string $ip

presentation form of ip address, or false if invalid

presentation form of ip address, or false if invalid

#
API documentation generated by ApiGen