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 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
    /**
26
     * @var int|null
27
     */
28
    protected $autonomousSystemNumber;
29
 
30
    /**
31
     * @var string|null
32
     */
33
    protected $autonomousSystemOrganization;
34
 
35
    /**
36
     * @var string
37
     */
38
    protected $ipAddress;
39
 
40
    /**
41
     * @var string
42
     */
43
    protected $network;
44
 
45
    /**
46
     * @ignore
47
     */
48
    public function __construct(array $raw)
49
    {
50
        parent::__construct($raw);
51
        $this->autonomousSystemNumber = $this->get('autonomous_system_number');
52
        $this->autonomousSystemOrganization =
53
            $this->get('autonomous_system_organization');
54
        $ipAddress = $this->get('ip_address');
55
        $this->ipAddress = $ipAddress;
56
        $this->network = Util::cidr($ipAddress, $this->get('prefix_len'));
57
    }
58
}