IP2Location.php
private function readCountryNameAndCode($pointer) {
    if (false === $pointer) {
      // Deal with invalid IPs
      $countryCode = self::INVALID_IP_ADDRESS;
      $countryName = self::INVALID_IP_ADDRESS;
    } elseif (0 === self::$columns[self::COUNTRY_CODE][$this->type]) {
      // If the field is not suported, return accordingly
      $countryCode = self::FIELD_NOT_SUPPORTED;
      $countryName = self::FIELD_NOT_SUPPORTED;
    } else {
      // Read the country code and name (the name shares the country's pointer,
      // but it must be artificially displaced 3 bytes ahead: 2 for the country code, one
      // for the country name's length)
      $countryCode = $this->readString($pointer + self::$columns[self::COUNTRY_CODE][$this->type]);
      $countryName = $this->readString($pointer + self::$columns[self::COUNTRY_NAME][$this->type], 3);
    }

    return [$countryName, $countryCode];
  }
private function readCountryNameAndCode($pointer) {
    if (false === $pointer) {
      // Deal with invalid IPs
      $countryCode = self::INVALID_IP_ADDRESS;
      $countryName = self::INVALID_IP_ADDRESS;
    } elseif (0 === self::$columns[self::COUNTRY_CODE][$this->type]) {
      // If the field is not suported, return accordingly
      $countryCode = self::FIELD_NOT_SUPPORTED;
      $countryName = self::FIELD_NOT_SUPPORTED;
    } else {
      // Read the country code and name (the name shares the country's pointer,
      // but it must be artificially displaced 3 bytes ahead: 2 for the country code, one
      // for the country name's length)
      $countryCode = $this->readString($pointer + self::$columns[self::COUNTRY_CODE][$this->type]);
      $countryName = $this->readString($pointer + self::$columns[self::COUNTRY_NAME][$this->type], 3);
    }

    return [$countryName, $countryCode];
  }
private function readCountryNameAndCode ( $ pointer ) { if ( false === $ pointer ) { // Deal with invalid IPs $ countryCode = self :: INVALID_IP_ADDRESS ; $ countryName = self :: INVALID_IP_ADDRESS ; } elseif ( 0 === self :: $ columns [ self :: COUNTRY_CODE ] [ $ this -> type ] ) { // If the field is not suported, return accordingly $ countryCode = self :: FIELD_NOT_SUPPORTED ; $ countryName = self :: FIELD_NOT_SUPPORTED ; } else { // Read the country code and name (the name shares the country's pointer, // but it must be artificially displaced 3 bytes ahead: 2 for the country code, one // for the country name's length) $ countryCode = $ this -> readString ( $ pointer + self :: $ columns [ self :: COUNTRY_CODE ] [ $ this -> type ] ) ; $ countryName = $ this -> readString ( $ pointer + self :: $ columns [ self :: COUNTRY_NAME ] [ $ this -> type ] , 3 ) ; } return [ $ countryName , $ countryCode ] ; }
High level function to fetch the country name and code

@access private
@param int|boolean $pointer  Position to read from, if false, return self::INVALID_IP_ADDRESS
@return array
High level function to fetch the country name and code