Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

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

   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 GeoLite2 ASN 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 $ipAddress The IP address that the data in the model is
  18   *     for.
  19   * @property-read string $network The network in CIDR notation associated with
  20   *      the record. In particular, this is the largest network where all of the
  21   *      fields besides $ipAddress have the same value.
  22   */
  23  class Asn extends AbstractModel
  24  {
  25      protected $autonomousSystemNumber;
  26      protected $autonomousSystemOrganization;
  27      protected $ipAddress;
  28      protected $network;
  29  
  30      /**
  31       * @ignore
  32       */
  33      public function __construct(array $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  }