Skip to content

Commit

Permalink
Move docs to the properties
Browse files Browse the repository at this point in the history
Previously this was not possible as we were using magic methods.
  • Loading branch information
oschwald committed Oct 31, 2023
1 parent dc20c43 commit 442d0a2
Show file tree
Hide file tree
Showing 18 changed files with 476 additions and 322 deletions.
62 changes: 42 additions & 20 deletions src/Model/AnonymousIp.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,58 @@

/**
* This class provides the GeoIP2 Anonymous IP model.
*
* @property-read bool $isAnonymous This is true if the IP address belongs to
* any sort of anonymous network.
* @property-read bool $isAnonymousVpn This is true if the IP address is
* registered to an anonymous VPN provider. If a VPN provider does not
* register subnets under names associated with them, we will likely only
* flag their IP ranges using the isHostingProvider property.
* @property-read bool $isHostingProvider This is true if the IP address belongs
* to a hosting or VPN provider (see description of isAnonymousVpn property).
* @property-read bool $isPublicProxy This is true if the IP address belongs to
* a public proxy.
* @property-read bool $isResidentialProxy This is true if the IP address is
* on a suspected anonymizing network and belongs to a residential ISP.
* @property-read bool $isTorExitNode This is true if the IP address is a Tor
* exit node.
* @property-read string $ipAddress The IP address that the data in the model is
* for.
* @property-read string $network 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.
*/
class AnonymousIp implements \JsonSerializable
{
/**
* @var bool this is true if the IP address belongs to
* any sort of anonymous network
*/
public readonly bool $isAnonymous;

/**
* @var bool This is true if the IP address is
* registered to an anonymous VPN provider. If a VPN provider does not
* register subnets under names associated with them, we will likely only
* flag their IP ranges using the isHostingProvider property.
*/
public readonly bool $isAnonymousVpn;

/**
* @var bool this is true if the IP address belongs
* to a hosting or VPN provider (see description of isAnonymousVpn property)
*/
public readonly bool $isHostingProvider;

/**
* @var bool this is true if the IP address belongs to
* a public proxy
*/
public readonly bool $isPublicProxy;

/**
* @var bool this is true if the IP address is
* on a suspected anonymizing network and belongs to a residential ISP
*/
public readonly bool $isResidentialProxy;

/**
* @var bool this is true if the IP address is a Tor
* exit node
*/
public readonly bool $isTorExitNode;

/**
* @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;

/**
Expand Down
32 changes: 21 additions & 11 deletions src/Model/Asn.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,33 @@

/**
* This class provides the GeoLite2 ASN model.
*
* @property-read int|null $autonomousSystemNumber The autonomous system number
* associated with the IP address.
* @property-read string|null $autonomousSystemOrganization The organization
* associated with the registered autonomous system number for the IP
* address.
* @property-read string $ipAddress The IP address that the data in the model is
* for.
* @property-read string $network 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.
*/
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;

/**
Expand Down
44 changes: 17 additions & 27 deletions src/Model/City.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,59 +4,49 @@

namespace GeoIp2\Model;

use GeoIp2\Record\Subdivision;

/**
* Model class for the data returned by City Plus web service and City
* database.
*
* See https://dev.maxmind.com/geoip/docs/web-services?lang=en for more
* details.
*
* @property-read \GeoIp2\Record\City $city City data for the requested IP
* address.
* @property-read \GeoIp2\Record\Location $location Location data for the
* requested IP address.
* @property-read \GeoIp2\Record\Postal $postal Postal data for the
* requested IP address.
* @property-read array $subdivisions An array \GeoIp2\Record\Subdivision
* objects representing the country subdivisions for the requested IP
* address. The number and type of subdivisions varies by country, but a
* subdivision is typically a state, province, county, etc. Subdivisions
* are ordered from most general (largest) to most specific (smallest).
* If the response did not contain any subdivisions, this method returns
* an empty array.
* @property-read \GeoIp2\Record\Subdivision $mostSpecificSubdivision An object
* representing the most specific subdivision returned. If the response
* did not contain any subdivisions, this method returns an empty
* \GeoIp2\Record\Subdivision object.
*/
class City extends Country
{
/**
* @ignore
* @var \GeoIp2\Record\City city data for the requested IP
* address
*/
public readonly \GeoIp2\Record\City $city;

/**
* @ignore
* @var \GeoIp2\Record\Location location data for the
* requested IP address
*/
public readonly \GeoIp2\Record\Location $location;

/**
* @ignore
* @var \GeoIp2\Record\Subdivision An object
* representing the most specific subdivision returned. If the response
* did not contain any subdivisions, this method returns an empty
* \GeoIp2\Record\Subdivision object.
*/
public readonly \GeoIp2\Record\Subdivision $mostSpecificSubdivision;

/**
* @ignore
* @var \GeoIp2\Record\Postal postal data for the
* requested IP address
*/
public readonly \GeoIp2\Record\Postal $postal;

/**
* @ignore
*
* @var array<\GeoIp2\Record\Subdivision>
* @var array<\GeoIp2\Record\Subdivision> An array of \GeoIp2\Record\Subdivision
* objects representing the country subdivisions for the requested IP
* address. The number and type of subdivisions varies by country, but a
* subdivision is typically a state, province, county, etc. Subdivisions
* are ordered from most general (largest) to most specific (smallest).
* If the response did not contain any subdivisions, this method returns
* an empty array.
*/
public readonly array $subdivisions;

Expand Down
25 changes: 16 additions & 9 deletions src/Model/ConnectionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,27 @@

/**
* This class provides the GeoIP2 Connection-Type model.
*
* @property-read string|null $connectionType The connection type may take the
* following values: "Dialup", "Cable/DSL", "Corporate", "Cellular", and
* "Satellite". Additional values may be added in the future.
* @property-read string $ipAddress The IP address that the data in the model is
* for.
* @property-read string $network 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.
*/
class ConnectionType implements \JsonSerializable
{
/**
* @var string|null The connection type may take the
* following values: "Dialup", "Cable/DSL", "Corporate", "Cellular", and
* "Satellite". Additional values may be added in the future.
*/
public readonly ?string $connectionType;

/**
* @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;

/**
Expand Down
51 changes: 33 additions & 18 deletions src/Model/Country.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,47 @@
* Model class for the data returned by GeoIP2 Country web service and database.
*
* See https://dev.maxmind.com/geoip/docs/web-services?lang=en for more details.
*
* @property-read \GeoIp2\Record\Continent $continent Continent data for the
* requested IP address.
* @property-read \GeoIp2\Record\Country $country Country data for the requested
* IP address. This object represents the country where MaxMind believes the
* end user is located.
* @property-read \GeoIp2\Record\MaxMind $maxmind Data related to your MaxMind
* account.
* @property-read \GeoIp2\Record\Country $registeredCountry Registered country
* data for the requested IP address. This record represents the country
* where the ISP has registered a given IP block and may differ from the
* user's country.
* @property-read \GeoIp2\Record\RepresentedCountry $representedCountry
* Represented country data for the requested IP address. The represented
* country is used for things like military bases. It is only present when
* the represented country differs from the country.
* @property-read \GeoIp2\Record\Traits $traits Data for the traits of the
* requested IP address.
*/
class Country implements \JsonSerializable
{
/**
* @var \GeoIp2\Record\Continent continent data for the
* requested IP address
*/
public readonly \GeoIp2\Record\Continent $continent;

/**
* @var \GeoIp2\Record\Country Country data for the requested
* IP address. This object represents the country where MaxMind believes the
* end user is located.
*/
public readonly \GeoIp2\Record\Country $country;

/**
* @var \GeoIp2\Record\MaxMind data related to your MaxMind
* account
*/
public readonly \GeoIp2\Record\MaxMind $maxmind;

/**
* @var \GeoIp2\Record\Country Registered country
* data for the requested IP address. This record represents the country
* where the ISP has registered a given IP block and may differ from the
* user's country.
*/
public readonly \GeoIp2\Record\Country $registeredCountry;

/**
* @var \GeoIp2\Record\RepresentedCountry * Represented country data for the requested IP address. The represented
* country is used for things like military bases. It is only present when
* the represented country differs from the country.
*/
public readonly \GeoIp2\Record\RepresentedCountry $representedCountry;

/**
* @var \GeoIp2\Record\Traits data for the traits of the
* requested IP address
*/
public readonly \GeoIp2\Record\Traits $traits;

/**
Expand Down
25 changes: 16 additions & 9 deletions src/Model/Domain.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,27 @@

/**
* This class provides the GeoIP2 Domain model.
*
* @property-read string|null $domain The second level domain associated with the
* IP address. This will be something like "example.com" or
* "example.co.uk", not "foo.example.com".
* @property-read string $ipAddress The IP address that the data in the model is
* for.
* @property-read string $network 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.
*/
class Domain implements \JsonSerializable
{
/**
* @var string|null The second level domain associated with the
* IP address. This will be something like "example.com" or
* "example.co.uk", not "foo.example.com".
*/
public readonly ?string $domain;

/**
* @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;

/**
Expand Down
Loading

0 comments on commit 442d0a2

Please sign in to comment.