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 GeoLite2 ASN 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 $ipAddress The IP address that the data in the model is
  16   *     for.
  17   * @property-read string $network The network in CIDR notation associated with
  18   *      the record. In particular, this is the largest network where all of the
  19   *      fields besides $ipAddress have the same value.
  20   */
  21  class Asn extends AbstractModel
  22  {
  23      protected $autonomousSystemNumber;
  24      protected $autonomousSystemOrganization;
  25      protected $ipAddress;
  26      protected $network;
  27  
  28      /**
  29       * @ignore
  30       *
  31       * @param mixed $raw
  32       */
  33      public function __construct($raw)
  34      {
  35          parent::__construct($raw);
  36          $this->autonomousSystemNumber = $this->get('autonomous_system_number');
  37          $this->autonomousSystemOrganization =
  38              $this->get('autonomous_system_organization');
  39          $ipAddress = $this->get('ip_address');
  40          $this->ipAddress = $ipAddress;
  41          $this->network = Util::cidr($ipAddress, $this->get('prefix_len'));
  42      }
  43  }