Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 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 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

   1  <?php
   2  
   3  namespace GeoIp2\Model;
   4  
   5  use GeoIp2\Util;
   6  
   7  /**
   8   * This class provides the GeoIP2 Domain model.
   9   *
  10   * @property-read string|null $domain The second level domain associated with the
  11   *     IP address. This will be something like "example.com" or
  12   *     "example.co.uk", not "foo.example.com".
  13   * @property-read string $ipAddress The IP address that the data in the model is
  14   *     for.
  15   * @property-read string $network The network in CIDR notation associated with
  16   *      the record. In particular, this is the largest network where all of the
  17   *      fields besides $ipAddress have the same value.
  18   */
  19  class Domain extends AbstractModel
  20  {
  21      protected $domain;
  22      protected $ipAddress;
  23      protected $network;
  24  
  25      /**
  26       * @ignore
  27       *
  28       * @param mixed $raw
  29       */
  30      public function __construct($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  }