InterfaceService
in package
Uses
TStringTools, TArrayTools, TNCLogger
Class InterfaceService
Table of Contents
- IFACE0 = 1
- IFACE1 = 2
- IFACE2 = 3
- IFACE3 = 4
- IFACE4 = 5
- IFACE_FRONTAL = 7
- IFACE_INTERNAL = 6
- IFACE_TEST = 99
- $ALERT : mixed
- $CRITICAL : mixed
- $DEBUG : mixed
- $EMERGENCY : mixed
- $ERROR : mixed
- $INFO : mixed
- $LIST_IFACE : mixed
- $NOTICE : mixed
- $TYPE_ARRAY : mixed
- $TYPE_BOOLEAN : mixed
- $TYPE_INTEGER : mixed
- $TYPE_NULL : mixed
- $TYPE_SERIALIZABLE : mixed
- $TYPE_STRING : mixed
- $WARNING : mixed
- $configService : ConfigService
- $currentInterface : int
- $outgoingInterface : int
- $remoteRequest : RemoteRequest
- $urlGenerator : IURLGenerator
- __construct() : mixed
- InterfaceService constructor.
- alert() : void
- debug() : void
- e() : void
- emergency() : void
- exception() : void
- generateRandomSentence() : string
- generateRandomWord() : string
- getCloudInstance() : string
- use this only if interface must be defined. If not, use getLocalInstance()
- getCloudPath() : string
- getCurrentInterface() : int
- getDateDiff() : string
- getFrontalPath() : string
- should be used when trying to generate an address
- getInterfaceFromInstance() : int
- getInterfaces() : array<string|int, mixed>
- getInternalInterfaces() : array<string|int, mixed>
- getLocalInstance() : string
- should be used when unsure about the used Interface
- getLocalPath() : string
- hasCurrentInterface() : bool
- humanReadable() : string
- isCurrentInterfaceInternal() : bool
- isInterfaceConfigured() : bool
- isInterfaceInternal() : bool
- log() : void
- logger() : LoggerInterface
- notice() : void
- setCurrentInterface() : void
- setCurrentInterfaceFromInstance() : void
- setCurrentInterfaceFromRequest() : void
- t() : void
- throwable() : void
- typeOf() : string
- validKey() : bool
- warning() : void
- cleanArray() : mixed
- commonPart() : string
- cut() : string
- extractArray() : mixed
- feedStringWithParams() : string
- get() : string
- getArray() : array<string|int, mixed>
- getBool() : bool
- getFloat() : float
- getInt() : int
- getList() : array<string|int, mixed>
- getObj() : mixed
- isUuid() : bool
- mustContains() : mixed
- token() : string
- uuid() : string
- Generate uuid: 2b5a7a87-8db1-445f-a17b-405790f91c80
- getCloudIdConfigKey() : string
- getTestingInstance() : string
Constants
IFACE0
public
mixed
IFACE0
= 1
IFACE1
public
mixed
IFACE1
= 2
IFACE2
public
mixed
IFACE2
= 3
IFACE3
public
mixed
IFACE3
= 4
IFACE4
public
mixed
IFACE4
= 5
IFACE_FRONTAL
public
mixed
IFACE_FRONTAL
= 7
IFACE_INTERNAL
public
mixed
IFACE_INTERNAL
= 6
IFACE_TEST
public
mixed
IFACE_TEST
= 99
Properties
$ALERT
public
static mixed
$ALERT
= 3
$CRITICAL
public
static mixed
$CRITICAL
= 3
$DEBUG
public
static mixed
$DEBUG
= 0
$EMERGENCY
public
static mixed
$EMERGENCY
= 4
$ERROR
public
static mixed
$ERROR
= 3
$INFO
public
static mixed
$INFO
= 1
$LIST_IFACE
public
static mixed
$LIST_IFACE
= [self::IFACE_INTERNAL => 'internal', self::IFACE_FRONTAL => 'frontal', self::IFACE0 => 'iface0', self::IFACE1 => 'iface1', self::IFACE2 => 'iface2', self::IFACE3 => 'iface3', self::IFACE4 => 'iface4']
$NOTICE
public
static mixed
$NOTICE
= 1
$TYPE_ARRAY
public
static mixed
$TYPE_ARRAY
= 'Array'
$TYPE_BOOLEAN
public
static mixed
$TYPE_BOOLEAN
= 'Boolean'
$TYPE_INTEGER
public
static mixed
$TYPE_INTEGER
= 'Integer'
$TYPE_NULL
public
static mixed
$TYPE_NULL
= 'Null'
$TYPE_SERIALIZABLE
public
static mixed
$TYPE_SERIALIZABLE
= 'Serializable'
$TYPE_STRING
public
static mixed
$TYPE_STRING
= 'String'
$WARNING
public
static mixed
$WARNING
= 2
$configService
private
ConfigService
$configService
$currentInterface
private
int
$currentInterface
= 0
$outgoingInterface
private
int
$outgoingInterface
= 0
$remoteRequest
private
RemoteRequest
$remoteRequest
$urlGenerator
private
IURLGenerator
$urlGenerator
Methods
__construct()
InterfaceService constructor.
public
__construct(IURLGenerator $urlGenerator, RemoteRequest $remoteRequest, ConfigService $configService) : mixed
Parameters
- $urlGenerator : IURLGenerator
- $remoteRequest : RemoteRequest
- $configService : ConfigService
Return values
mixed —alert()
public
alert(string $message[, bool $trace = false ][, array<string|int, mixed> $serializable = [] ]) : void
Parameters
- $message : string
- $trace : bool = false
- $serializable : array<string|int, mixed> = []
Return values
void —debug()
public
debug(string $message[, array<string|int, mixed> $serializable = [] ]) : void
Parameters
- $message : string
- $serializable : array<string|int, mixed> = []
Return values
void —e()
public
e(Exception $e[, array<string|int, mixed> $serializable = [] ]) : void
Parameters
- $e : Exception
- $serializable : array<string|int, mixed> = []
Return values
void —emergency()
public
emergency(string $message[, bool $trace = false ][, array<string|int, mixed> $serializable = [] ]) : void
Parameters
- $message : string
- $trace : bool = false
- $serializable : array<string|int, mixed> = []
Return values
void —exception()
public
exception(Exception $e[, int|array<string|int, mixed> $level = 3 ][, array<string|int, mixed> $serializable = [] ]) : void
Parameters
- $e : Exception
- $level : int|array<string|int, mixed> = 3
- $serializable : array<string|int, mixed> = []
Return values
void —generateRandomSentence()
public
generateRandomSentence([int $words = 5 ]) : string
Parameters
- $words : int = 5
Return values
string —generateRandomWord()
public
generateRandomWord([int $length = 8 ]) : string
Parameters
- $length : int = 8
Return values
string —getCloudInstance()
use this only if interface must be defined. If not, use getLocalInstance()
public
getCloudInstance(int $interface) : string
Parameters
- $interface : int
Tags
Return values
string —getCloudPath()
public
getCloudPath([string $route = '' ][, array<string|int, mixed> $args = [] ], int $interface) : string
Parameters
- $route : string = ''
- $args : array<string|int, mixed> = []
- $interface : int
Tags
Return values
string —getCurrentInterface()
public
getCurrentInterface() : int
Tags
Return values
int —getDateDiff()
public
getDateDiff(int $first, int $second[, bool $short = false ][, array<string|int, mixed> $words = [] ]) : string
Parameters
- $first : int
- $second : int
- $short : bool = false
- $words : array<string|int, mixed> = []
Tags
Return values
string —getFrontalPath()
should be used when trying to generate an address
public
getFrontalPath(string $route, array<string|int, mixed> $args) : string
Parameters
- $route : string
- $args : array<string|int, mixed>
Return values
string —getInterfaceFromInstance()
public
getInterfaceFromInstance(string $instance) : int
Parameters
- $instance : string
Tags
Return values
int —getInterfaces()
public
getInterfaces([bool $useString = false ]) : array<string|int, mixed>
Parameters
- $useString : bool = false
Return values
array<string|int, mixed> —getInternalInterfaces()
public
getInternalInterfaces([bool $useString = false ]) : array<string|int, mixed>
Parameters
- $useString : bool = false
Return values
array<string|int, mixed> —getLocalInstance()
should be used when unsure about the used Interface
public
getLocalInstance() : string
Return values
string —getLocalPath()
public
getLocalPath(string $route, array<string|int, mixed> $args) : string
Parameters
- $route : string
- $args : array<string|int, mixed>
Return values
string —hasCurrentInterface()
public
hasCurrentInterface() : bool
Return values
bool —humanReadable()
public
humanReadable(int $bytes) : string
Parameters
- $bytes : int
Return values
string —isCurrentInterfaceInternal()
public
isCurrentInterfaceInternal() : bool
Tags
Return values
bool —isInterfaceConfigured()
public
isInterfaceConfigured(int $interface) : bool
Parameters
- $interface : int
Return values
bool —isInterfaceInternal()
public
isInterfaceInternal(int $interface) : bool
Parameters
- $interface : int
Return values
bool —log()
public
log(int $level, string $message[, bool $trace = false ][, array<string|int, mixed> $serializable = [] ]) : void
Parameters
- $level : int
- $message : string
- $trace : bool = false
- $serializable : array<string|int, mixed> = []
Return values
void —logger()
public
logger() : LoggerInterface
Return values
LoggerInterface —notice()
public
notice(string $message[, bool $trace = false ][, array<string|int, mixed> $serializable = [] ]) : void
Parameters
- $message : string
- $trace : bool = false
- $serializable : array<string|int, mixed> = []
Return values
void —setCurrentInterface()
public
setCurrentInterface(int $interface) : void
Parameters
- $interface : int
Return values
void —setCurrentInterfaceFromInstance()
public
setCurrentInterfaceFromInstance(string $instance) : void
Parameters
- $instance : string
Return values
void —setCurrentInterfaceFromRequest()
public
setCurrentInterfaceFromRequest(IRequest $request[, string $testToken = '' ]) : void
Parameters
- $request : IRequest
- $testToken : string = ''
Return values
void —t()
public
t(Throwable $t[, array<string|int, mixed> $serializable = [] ]) : void
Parameters
- $t : Throwable
- $serializable : array<string|int, mixed> = []
Return values
void —throwable()
public
throwable(Throwable $t[, int $level = 3 ][, array<string|int, mixed> $serializable = [] ]) : void
Parameters
- $t : Throwable
- $level : int = 3
- $serializable : array<string|int, mixed> = []
Return values
void —typeOf()
public
typeOf(string $key, array<string|int, mixed> $arr[, bool $root = true ]) : string
Parameters
- $key : string
- $arr : array<string|int, mixed>
- $root : bool = true
Tags
Return values
string —validKey()
public
validKey(string $k, array<string|int, mixed> $arr) : bool
Parameters
- $k : string
- $arr : array<string|int, mixed>
Return values
bool —warning()
public
warning(string $message[, bool $trace = false ][, array<string|int, mixed> $serializable = [] ]) : void
Parameters
- $message : string
- $trace : bool = false
- $serializable : array<string|int, mixed> = []
Return values
void —cleanArray()
protected
cleanArray(array<string|int, mixed> &$arr) : mixed
Parameters
- $arr : array<string|int, mixed>
Return values
mixed —commonPart()
protected
commonPart(string $str1, string $str2[, bool $cs = true ]) : string
Parameters
- $str1 : string
- $str2 : string
- $cs : bool = true
-
case sensitive ?
Return values
string —cut()
protected
cut(string $line, int $length) : string
Parameters
- $line : string
- $length : int
Return values
string —extractArray()
protected
extractArray(string $k, string $value, array<string|int, mixed> $list) : mixed
Parameters
- $k : string
- $value : string
- $list : array<string|int, mixed>
Tags
Return values
mixed —feedStringWithParams()
protected
feedStringWithParams(string $line, array<string|int, mixed> $params) : string
Parameters
- $line : string
- $params : array<string|int, mixed>
Return values
string —get()
protected
get(string $k, array<string|int, mixed> $arr[, string $default = '' ]) : string
Parameters
- $k : string
- $arr : array<string|int, mixed>
- $default : string = ''
Return values
string —getArray()
protected
getArray(string $k, array<string|int, mixed> $arr[, array<string|int, mixed> $default = [] ]) : array<string|int, mixed>
Parameters
- $k : string
- $arr : array<string|int, mixed>
- $default : array<string|int, mixed> = []
Return values
array<string|int, mixed> —getBool()
protected
getBool(string $k, array<string|int, mixed> $arr[, bool $default = false ]) : bool
Parameters
- $k : string
- $arr : array<string|int, mixed>
- $default : bool = false
Return values
bool —getFloat()
protected
getFloat(string $k, array<string|int, mixed> $arr, float $default) : float
Parameters
- $k : string
- $arr : array<string|int, mixed>
- $default : float
Return values
float —getInt()
protected
getInt(string $k, array<string|int, mixed> $arr, int $default) : int
Parameters
- $k : string
- $arr : array<string|int, mixed>
- $default : int
Return values
int —getList()
protected
getList(string $k, array<string|int, mixed> $arr, array<string|int, mixed> $import[, array<string|int, mixed> $default = [] ]) : array<string|int, mixed>
Parameters
- $k : string
- $arr : array<string|int, mixed>
- $import : array<string|int, mixed>
- $default : array<string|int, mixed> = []
Return values
array<string|int, mixed> —getObj()
protected
getObj(string $k, array<string|int, mixed> $arr[, JsonSerializable|null $default = null ]) : mixed
Parameters
- $k : string
- $arr : array<string|int, mixed>
- $default : JsonSerializable|null = null
Return values
mixed —isUuid()
protected
isUuid(string $uuid) : bool
Parameters
- $uuid : string
Return values
bool —mustContains()
protected
mustContains(array<string|int, mixed> $keys, array<string|int, mixed> $arr) : mixed
Parameters
- $keys : array<string|int, mixed>
- $arr : array<string|int, mixed>
Tags
Return values
mixed —token()
protected
token([int $length = 15 ]) : string
Parameters
- $length : int = 15
Return values
string —uuid()
Generate uuid: 2b5a7a87-8db1-445f-a17b-405790f91c80
protected
uuid(int $length) : string
Parameters
- $length : int
Return values
string —getCloudIdConfigKey()
private
getCloudIdConfigKey(int $interface) : string
Parameters
- $interface : int
Tags
Return values
string —getTestingInstance()
private
getTestingInstance() : string