Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311] [Versions 311 and 402] [Versions 311 and 403] [Versions 39 and 311]

   1  <?php
   2  
   3  declare(strict_types=1);
   4  
   5  namespace GeoIp2\Model;
   6  
   7  use GeoIp2\Util;
   8  
   9  /**
  10   * This class provides the GeoIP2 ISP model.
  11   *
  12   * @property-read int|null $autonomousSystemNumber The autonomous system number
  13   *     associated with the IP address.
  14   * @property-read string|null $autonomousSystemOrganization The organization
  15   *     associated with the registered autonomous system number for the IP
  16   *     address.
  17   * @property-read string|null $isp The name of the ISP associated with the IP
  18   *     address.
  19   * @property-read string|null $organization The name of the organization associated
  20   *     with the IP address.
  21   * @property-read string $ipAddress The IP address that the data in the model is
  22   *     for.
  23   * @property-read string $network The network in CIDR notation associated with
  24   *      the record. In particular, this is the largest network where all of the
  25   *      fields besides $ipAddress have the same value.
  26   */
  27  class Isp extends AbstractModel
  28  {
  29      protected $autonomousSystemNumber;
  30      protected $autonomousSystemOrganization;
  31      protected $isp;
  32      protected $organization;
  33      protected $ipAddress;
  34      protected $network;
  35  
  36      /**
  37       * @ignore
  38       */
  39      public function __construct(array $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  }