Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 39 and 311] [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]

   1  <?php
   2  
   3  namespace GeoIp2\Model;
   4  
   5  use GeoIp2\Util;
   6  
   7  /**
   8   * This class provides the GeoIP2 ISP model.
   9   *
  10   * @property-read int|null $autonomousSystemNumber The autonomous system number
  11   *     associated with the IP address.
  12   * @property-read string|null $autonomousSystemOrganization The organization
  13   *     associated with the registered autonomous system number for the IP
  14   *     address.
  15   * @property-read string|null $isp The name of the ISP associated with the IP
  16   *     address.
  17   * @property-read string|null $organization The name of the organization associated
  18   *     with the IP address.
  19   * @property-read string $ipAddress The IP address that the data in the model is
  20   *     for.
  21   * @property-read string $network The network in CIDR notation associated with
  22   *      the record. In particular, this is the largest network where all of the
  23   *      fields besides $ipAddress have the same value.
  24   */
  25  class Isp extends AbstractModel
  26  {
  27      protected $autonomousSystemNumber;
  28      protected $autonomousSystemOrganization;
  29      protected $isp;
  30      protected $organization;
  31      protected $ipAddress;
  32      protected $network;
  33  
  34      /**
  35       * @ignore
  36       *
  37       * @param mixed $raw
  38       */
  39      public function __construct($raw)
  40      {
  41          parent::__construct($raw);
  42          $this->autonomousSystemNumber = $this->get('autonomous_system_number');
  43          $this->autonomousSystemOrganization =
  44              $this->get('autonomous_system_organization');
  45          $this->isp = $this->get('isp');
  46          $this->organization = $this->get('organization');
  47  
  48          $ipAddress = $this->get('ip_address');
  49          $this->ipAddress = $ipAddress;
  50          $this->network = Util::cidr($ipAddress, $this->get('prefix_len'));
  51      }
  52  }