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 GeoIP2 Domain model.
  11   *
  12   * @property-read string|null $domain The second level domain associated with the
  13   *     IP address. This will be something like "example.com" or
  14   *     "example.co.uk", not "foo.example.com".
  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 Domain extends AbstractModel
  22  {
  23      protected $domain;
  24      protected $ipAddress;
  25      protected $network;
  26  
  27      /**
  28       * @ignore
  29       */
  30      public function __construct(array $raw)
  31      {
  32          parent::__construct($raw);
  33  
  34          $this->domain = $this->get('domain');
  35          $ipAddress = $this->get('ip_address');
  36          $this->ipAddress = $ipAddress;
  37          $this->network = Util::cidr($ipAddress, $this->get('prefix_len'));
  38      }
  39  }