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 ISP 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|null $isp The name of the ISP associated with the IP
18
 *     address.
19
 * @property-read string|null $mobileCountryCode The [mobile country code
20
 *     (MCC)](https://en.wikipedia.org/wiki/Mobile_country_code) associated with
21
 *     the IP address and ISP.
22
 * @property-read string|null $mobileNetworkCode The [mobile network code
23
 *     (MNC)](https://en.wikipedia.org/wiki/Mobile_country_code) associated with
24
 *     the IP address and ISP.
25
 * @property-read string|null $organization The name of the organization associated
26
 *     with the IP address.
27
 * @property-read string $ipAddress The IP address that the data in the model is
28
 *     for.
29
 * @property-read string $network The network in CIDR notation associated with
30
 *      the record. In particular, this is the largest network where all of the
31
 *      fields besides $ipAddress have the same value.
32
 */
33
class Isp extends AbstractModel
34
{
35
    /**
36
     * @var int|null
37
     */
38
    protected $autonomousSystemNumber;
39
 
40
    /**
41
     * @var string|null
42
     */
43
    protected $autonomousSystemOrganization;
44
 
45
    /**
46
     * @var string|null
47
     */
48
    protected $isp;
49
 
50
    /**
51
     * @var string|null
52
     */
53
    protected $mobileCountryCode;
54
 
55
    /**
56
     * @var string|null
57
     */
58
    protected $mobileNetworkCode;
59
 
60
    /**
61
     * @var string|null
62
     */
63
    protected $organization;
64
 
65
    /**
66
     * @var string
67
     */
68
    protected $ipAddress;
69
 
70
    /**
71
     * @var string
72
     */
73
    protected $network;
74
 
75
    /**
76
     * @ignore
77
     */
78
    public function __construct(array $raw)
79
    {
80
        parent::__construct($raw);
81
        $this->autonomousSystemNumber = $this->get('autonomous_system_number');
82
        $this->autonomousSystemOrganization =
83
            $this->get('autonomous_system_organization');
84
        $this->isp = $this->get('isp');
85
        $this->mobileCountryCode = $this->get('mobile_country_code');
86
        $this->mobileNetworkCode = $this->get('mobile_network_code');
87
        $this->organization = $this->get('organization');
88
 
89
        $ipAddress = $this->get('ip_address');
90
        $this->ipAddress = $ipAddress;
91
        $this->network = Util::cidr($ipAddress, $this->get('prefix_len'));
92
    }
93
}