class BanIpManager implements BanIpManagerInterface (View source)

Ban IP manager.

Properties

protected Connection $connection

The database connection used to check the IP against.

Methods

__construct(Connection $connection)

Constructs a BanIpManager object.

bool
isBanned(string $ip)

Returns if this IP address is banned.

findAll()

Finds all banned IP addresses.

banIp(string $ip)

Bans an IP address.

unbanIp(string $id)

Unbans an IP address.

string|false
findById(int $ban_id)

Finds a banned IP address by its ID.

Details

__construct(Connection $connection)

Constructs a BanIpManager object.

Parameters

Connection $connection

The database connection which will be used to check the IP against.

bool isBanned(string $ip)

Returns if this IP address is banned.

Parameters

string $ip

The IP address to check.

Return Value

bool

TRUE if the IP address is banned, FALSE otherwise.

StatementInterface findAll()

Finds all banned IP addresses.

Return Value

StatementInterface

The result of the database query.

banIp(string $ip)

Bans an IP address.

Parameters

string $ip

The IP address to ban.

unbanIp(string $id)

Unbans an IP address.

Parameters

string $id

The IP address to unban.

string|false findById(int $ban_id)

Finds a banned IP address by its ID.

Parameters

int $ban_id

The ID for a banned IP address.

Return Value

string|false

Either the banned IP address or FALSE if none exist with that ID.