Skip to content

The Dependency Inversion Principle #125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Database/Reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* corrupt or invalid, a {@link \MaxMind\Db\Reader\InvalidDatabaseException}
* will be thrown.
*/
class Reader implements ProviderInterface
class Reader implements ReaderInterface, ProviderInterface
{
private $dbReader;
private $locales;
Expand Down
88 changes: 88 additions & 0 deletions src/Database/ReaderInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?php

namespace GeoIp2\Database;

interface ReaderInterface
{
/**
* This method returns a GeoIP2 City model.
*
* @param string $ipAddress an IPv4 or IPv6 address as a string
*
* @return \GeoIp2\Model\City
*/
public function city($ipAddress);

/**
* This method returns a GeoIP2 Country model.
*
* @param string $ipAddress an IPv4 or IPv6 address as a string
*
* @return \GeoIp2\Model\Country
*/
public function country($ipAddress);

/**
* This method returns a GeoIP2 Anonymous IP model.
*
* @param string $ipAddress an IPv4 or IPv6 address as a string
*
* @return \GeoIp2\Model\AnonymousIp
*/
public function anonymousIp($ipAddress);

/**
* This method returns a GeoLite2 ASN model.
*
* @param string $ipAddress an IPv4 or IPv6 address as a string
*
* @return \GeoIp2\Model\Asn
*/
public function asn($ipAddress);

/**
* This method returns a GeoIP2 Connection Type model.
*
* @param string $ipAddress an IPv4 or IPv6 address as a string
*
* @return \GeoIp2\Model\ConnectionType
*/
public function connectionType($ipAddress);

/**
* This method returns a GeoIP2 Domain model.
*
* @param string $ipAddress an IPv4 or IPv6 address as a string
*
* @return \GeoIp2\Model\Domain
*/
public function domain($ipAddress);

/**
* This method returns a GeoIP2 Enterprise model.
*
* @param string $ipAddress an IPv4 or IPv6 address as a string
*
* @return \GeoIp2\Model\Enterprise
*/
public function enterprise($ipAddress);

/**
* This method returns a GeoIP2 ISP model.
*
* @param string $ipAddress an IPv4 or IPv6 address as a string
*
* @return \GeoIp2\Model\Isp
*/
public function isp($ipAddress);

/**
* @return \MaxMind\Db\Reader\Metadata object for the database
*/
public function metadata();

/**
* Closes the GeoIP2 database and returns the resources to the system.
*/
public function close();
}