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 Anonymous IP model.
11
 *
12
 * @property-read bool $isAnonymous This is true if the IP address belongs to
13
 *     any sort of anonymous network.
14
 * @property-read bool $isAnonymousVpn This is true if the IP address is
15
 *     registered to an anonymous VPN provider. If a VPN provider does not
16
 *     register subnets under names associated with them, we will likely only
17
 *     flag their IP ranges using the isHostingProvider property.
18
 * @property-read bool $isHostingProvider This is true if the IP address belongs
19
 *     to a hosting or VPN provider (see description of isAnonymousVpn property).
20
 * @property-read bool $isPublicProxy This is true if the IP address belongs to
21
 *     a public proxy.
22
 * @property-read bool $isResidentialProxy This is true if the IP address is
23
 *     on a suspected anonymizing network and belongs to a residential ISP.
24
 * @property-read bool $isTorExitNode This is true if the IP address is a Tor
25
 *     exit node.
26
 * @property-read string $ipAddress The IP address that the data in the model is
27
 *     for.
28
 * @property-read string $network The network in CIDR notation associated with
29
 *      the record. In particular, this is the largest network where all of the
30
 *      fields besides $ipAddress have the same value.
31
 */
32
class AnonymousIp extends AbstractModel
33
{
34
    /**
35
     * @var bool
36
     */
37
    protected $isAnonymous;
38
 
39
    /**
40
     * @var bool
41
     */
42
    protected $isAnonymousVpn;
43
 
44
    /**
45
     * @var bool
46
     */
47
    protected $isHostingProvider;
48
 
49
    /**
50
     * @var bool
51
     */
52
    protected $isPublicProxy;
53
 
54
    /**
55
     * @var bool
56
     */
57
    protected $isResidentialProxy;
58
 
59
    /**
60
     * @var bool
61
     */
62
    protected $isTorExitNode;
63
 
64
    /**
65
     * @var string
66
     */
67
    protected $ipAddress;
68
 
69
    /**
70
     * @var string
71
     */
72
    protected $network;
73
 
74
    /**
75
     * @ignore
76
     */
77
    public function __construct(array $raw)
78
    {
79
        parent::__construct($raw);
80
 
81
        $this->isAnonymous = $this->get('is_anonymous');
82
        $this->isAnonymousVpn = $this->get('is_anonymous_vpn');
83
        $this->isHostingProvider = $this->get('is_hosting_provider');
84
        $this->isPublicProxy = $this->get('is_public_proxy');
85
        $this->isResidentialProxy = $this->get('is_residential_proxy');
86
        $this->isTorExitNode = $this->get('is_tor_exit_node');
87
        $ipAddress = $this->get('ip_address');
88
        $this->ipAddress = $ipAddress;
89
        $this->network = Util::cidr($ipAddress, $this->get('prefix_len'));
90
    }
91
}