Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 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
    /**
24
     * @var string|null
25
     */
26
    protected $domain;
27
 
28
    /**
29
     * @var string
30
     */
31
    protected $ipAddress;
32
 
33
    /**
34
     * @var string
35
     */
36
    protected $network;
37
 
38
    /**
39
     * @ignore
40
     */
41
    public function __construct(array $raw)
42
    {
43
        parent::__construct($raw);
44
 
45
        $this->domain = $this->get('domain');
46
        $ipAddress = $this->get('ip_address');
47
        $this->ipAddress = $ipAddress;
48
        $this->network = Util::cidr($ipAddress, $this->get('prefix_len'));
49
    }
50
}