PHP 8.3.31
Preview: Asn.php Size: 1.97 KB
/home/getspomw/royalsquad.us/vendor/geoip2/geoip2/src/Model/Asn.php

<?php

declare(strict_types=1);

namespace GeoIp2\Model;

use GeoIp2\Util;

/**
 * This class provides the GeoLite2 ASN model.
 */
class Asn implements \JsonSerializable
{
    /**
     * @var int|null the autonomous system number
     *               associated with the IP address
     */
    public readonly ?int $autonomousSystemNumber;

    /**
     * @var string|null the organization
     *                  associated with the registered autonomous system number for the IP
     *                  address
     */
    public readonly ?string $autonomousSystemOrganization;

    /**
     * @var string the IP address that the data in the model is
     *             for
     */
    public readonly string $ipAddress;

    /**
     * @var string The network in CIDR notation associated with
     *             the record. In particular, this is the largest network where all of the
     *             fields besides $ipAddress have the same value.
     */
    public readonly string $network;

    /**
     * @ignore
     *
     * @param array<string, mixed> $raw
     */
    public function __construct(array $raw)
    {
        $this->autonomousSystemNumber = $raw['autonomous_system_number'] ?? null;
        $this->autonomousSystemOrganization
            = $raw['autonomous_system_organization'] ?? null;
        $ipAddress = $raw['ip_address'];
        $this->ipAddress = $ipAddress;
        $this->network = Util::cidr($ipAddress, $raw['prefix_len']);
    }

    /**
     * @return array<string, mixed>|null
     */
    public function jsonSerialize(): ?array
    {
        $js = [];

        if ($this->autonomousSystemNumber !== null) {
            $js['autonomous_system_number'] = $this->autonomousSystemNumber;
        }
        if ($this->autonomousSystemOrganization !== null) {
            $js['autonomous_system_organization'] = $this->autonomousSystemOrganization;
        }
        $js['ip_address'] = $this->ipAddress;
        $js['network'] = $this->network;

        return $js;
    }
}

Directory Contents

Dirs: 0 × Files: 10

Name Size Perms Modified Actions
3.03 KB lrw-rw-rw- 2025-05-05 08:48:26
Edit Download
1.77 KB lrw-rw-rw- 2025-05-05 08:48:26
Edit Download
1.97 KB lrw-rw-rw- 2025-05-05 08:48:26
Edit Download
3.70 KB lrw-rw-rw- 2025-05-05 08:48:26
Edit Download
1.58 KB lrw-rw-rw- 2025-05-05 08:48:26
Edit Download
3.63 KB lrw-rw-rw- 2025-05-05 08:48:26
Edit Download
1.49 KB lrw-rw-rw- 2025-05-05 08:48:26
Edit Download
279 B lrw-rw-rw- 2025-05-05 08:48:26
Edit Download
270 B lrw-rw-rw- 2025-05-05 08:48:26
Edit Download
3.46 KB lrw-rw-rw- 2025-05-05 08:48:26
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).