\phpWTLaBasicDataFormatter

Abstract class for a content (logger field) formatter (also handling field enclosing marks).

Summary

Methods
Properties
Constants
getInstance()
formatField()
formatAll()
format()
formatAllField()
enclose()
encloseField()
buildRequestLineString()
explodeRequestLineString()
No public properties found
No constants found
__clone()
__sleep()
__wakeup()
__construct()
$_instance
$loggerContent
$fieldDescriptor
N/A
No private methods found
No private properties found
N/A

Properties

$_instance

$_instance : 

Array to hold instances of all derived classes.

Type

$loggerContent

$loggerContent : 

Type

$fieldDescriptor

$fieldDescriptor : 

Type

Methods

getInstance()

getInstance(array|mixed|null  $inject = null) : \phpWTL\$_instance[$class]

Create new instance or give back already existing one.

Parameters

array|mixed|null $inject

Can be used to inject one or more parameter(s) into the constructor

Returns

\phpWTL\$_instance[$class] —

The instance of a derived class

formatField()

formatField(string  $field_name, string  $value = null) 

Format only a single log field and store it in the associated LoggerContent object.

Parameters

string $field_name

ID of log format field.

string $value

Provide an (optional) value to format and pass thru to the LoggerContent object, so allowing for the injection of external data.

formatAll()

formatAll() 

Format and enclose (prefix/suffix) all log fields.

format()

format() 

Format only all log fields.

formatAllField()

formatAllField(string  $field_name, string  $value = null) 

Format and enclose (prefix/suffix) a single log field and store it in the associated LoggerContent object.

Parameters

string $field_name

ID of log format field.

string $value

Provide an (optional) value to format and pass thru to the LoggerContent object, so allowing for the injection of external data.

enclose()

enclose() 

Enclose only (prefix/suffix) all log fields.

encloseField()

encloseField(string  $field_name, string  $value = null) 

Enclose (prefix/suffix) a single log field and store it in the associated LoggerContent object.

Parameters

string $field_name

ID of log format field.

string $value

Provide an (optional) value to format and pass thru to the LoggerContent object, so allowing for the injection of external data.

buildRequestLineString()

buildRequestLineString(string  $request_method, string  $request_uri, string  $query_string = null, string  $protocol) : string

Helper method to build content for the "request line" of the "common" and "combined" log format.

Parameters

string $request_method
string $request_uri
string $query_string

May be blank

string $protocol

Returns

string —

Proper request line, format: request_method request_uri[?query_string] protocol

explodeRequestLineString()

explodeRequestLineString(string  $request_line) : array

Helper method to split the content of a "request line" of the "common" and "combined" log format into its chunks.

Parameters

string $request_line

Returns

array —

An associative array representing the single portions of the request line: request_method[0], request_uri[1], query_string[2], protocol[3].

__clone()

__clone() 

Disable cloning for singleton.

Throws

\phpWTL\Exception

if called

__sleep()

__sleep() 

Disable serialization for singleton.

Throws

\phpWTL\Exception

if called

__wakeup()

__wakeup() 

Disable de-serialization for singleton.

Throws

\phpWTL\Exception

if called

__construct()

__construct(object|null  $inject = null) 

Constructor stump.

Parameters

object|null $inject

Can be used to inject one or more parameter(s) into the constructor.