FormatQueryFilter
extends QueryFilter
in package
Defines a query filter that obtains matches to a field's value exactly.
Table of Contents
Properties
- $name : string
- $__log_level : int
Methods
- evaluate() : bool
- Checks if the given field value matches the format given filter value.
- get_all_names() : array<string|int, mixed>
- Obtains an array of all available QueryFilter names.
- get_by_name() : QueryFilter
- Obtains the QueryFilter object associated with the given name.
- get_class_fqn() : string
- Obtains the fully qualified name of the called class.
- get_class_shortname() : string
- Obtains the shortname of the called class.
- get_classes_in_namespace() : array<string|int, mixed>
- Obtains all classes associated with this class's current namespace.
- log() : void
- Writes a log entry to the applicable log file
Properties
$name
public
string
$name
= 'format'
The name of this query filter. This is used to identify the filter to use during queries.
$__log_level
private
static int
$__log_level
Methods
evaluate()
Checks if the given field value matches the format given filter value.
public
evaluate(mixed $field_value, mixed $filter_value) : bool
Supported formats are:
- ipv4: Checks if the field value is a valid IPv4 address.
- ipv6: Checks if the field value is a valid IPv6 address.
- ip: Checks if the field value is a valid IPv4 or IPv6 address.
- mac: Checks if the field value is a valid MAC address.
- subnetv4: Checks if the field value is a valid IPv4 subnet.
- subnetv6: Checks if the field value is a valid IPv6 subnet.
- subnet: Checks if the field value is a valid IPv4 or IPv6 subnet.
- email: Checks if the field value is a valid email address.
- url: Checks if the field value is a valid URL.
- numeric: Checks if the field value is a numeric value.
- hostname: Checks if the field value is a valid hostname.
- fqdn: Checks if the field value is a valid fully qualified domain name.
- port: Checks if the field value is a valid port number.
- portrange: Checks if the field value is a valid port range.
- alias: Checks if the field value is a valid alias.
Parameters
- $field_value : mixed
-
The value of the field being used to filter.
- $filter_value : mixed
-
The value of the filter criteria to evaluate against.
Return values
bool —true if the field_value matches the filter_value, false otherwise.
get_all_names()
Obtains an array of all available QueryFilter names.
public
static get_all_names() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array of all available QueryFilter names.
get_by_name()
Obtains the QueryFilter object associated with the given name.
public
static get_by_name(string $name) : QueryFilter
Parameters
- $name : string
-
The name of the QueryFilter to obtain.
Tags
Return values
QueryFilter —The QueryFilter object associated with the given name.
get_class_fqn()
Obtains the fully qualified name of the called class.
public
static get_class_fqn() : string
Return values
string —The FQN for this object's class.
get_class_shortname()
Obtains the shortname of the called class.
public
static get_class_shortname() : string
Return values
string —The shortname for this object's class.
get_classes_in_namespace()
Obtains all classes associated with this class's current namespace.
public
get_classes_in_namespace([bool $shortnames = false ]) : array<string|int, mixed>
Parameters
- $shortnames : bool = false
Return values
array<string|int, mixed> —An array of classes currently in this object's namespace
log()
Writes a log entry to the applicable log file
public
static log(int $level, string $message[, string $logfile = 'restapi' ]) : void
Parameters
- $level : int
-
The log level to write. This should be one of the LOG_* constants defined by syslog.
- $message : string
-
The message to write to the log file.
- $logfile : string = 'restapi'
-
The log file to write to. This must be a valid logging facility defined in the package's info.xml file.