Http
extends AbstractAdapter
in package
Auditor HTTP class
Tags
Table of Contents
Constants
Properties
- $action : string|null
- Action (created, updated, deleted)
- $domain : string|null
- Domain
- $fetchClient : Client|null
- Client to fetch the audit results
- $metadata : array<string|int, mixed>
- Metadata
- $method : string|null
- Method
- $model : string|null
- Model name
- $modelId : int|string|null
- Model ID
- $modified : array<string|int, mixed>
- Modified model state differences
- $original : array<string|int, mixed>
- Original model state differences
- $route : string|null
- Route
- $sendClient : Client|null
- Client to send the audit results
- $stateData : array<string|int, mixed>
- Final state data
- $userId : int|string|null
- User ID
- $username : string|null
- Username
Methods
- __construct() : mixed
- Constructor
- addMetadata() : AbstractAdapter
- Add to the metadata
- getAction() : string|null
- Get the action
- getDomain() : string|null
- Get the domain
- getFetchClient() : Client
- Get the fetch stream
- getFetchedResult() : mixed
- Get the fetched result
- getMetadata() : mixed
- Get the metadata
- getMethod() : string|null
- Get the method
- getModel() : string|null
- Get the model name
- getModelId() : int|string|null
- Get the model ID
- getModified() : array<string|int, mixed>
- Get the modified model state differences
- getOriginal() : array<string|int, mixed>
- Get the original model state differences
- getRoute() : string|null
- Get the route
- getSendClient() : Client
- Get the send stream
- getSnapshot() : array<string|int, mixed>
- Get model snapshot by ID
- getStateByDate() : array<string|int, mixed>
- Get model state by date
- getStateById() : array<string|int, mixed>
- Get model state by ID
- getStateByModel() : array<string|int, mixed>
- Get model state by model
- getStateByTimestamp() : array<string|int, mixed>
- Get model state by timestamp
- getStateData() : mixed
- Get the final state
- getStates() : array<string|int, mixed>
- Get model states
- getUserId() : int|string|null
- Get the user ID
- getUsername() : string|null
- Get the username
- hasDiff() : bool
- Check if the model states are different
- hasFetchClient() : bool
- Determine if the adapter has a fetch stream
- hasMetadata() : bool
- Determine if there is metadata
- hasStateData() : bool
- Determine if there is final state data
- prepareData() : array<string|int, mixed>
- Prepare data
- resolveDiff() : AbstractAdapter
- Resolve the differences in values between the model states
- send() : Response
- Send the results of the audit
- setDiff() : AbstractAdapter
- Set the differences in values between the model states (that have already been processed)
- setDomain() : AbstractAdapter
- Set the domain
- setFetchClient() : Http
- Set the fetch stream
- setMetadata() : AbstractAdapter
- Set the metadata
- setMethod() : AbstractAdapter
- Set the method
- setModel() : AbstractAdapter
- Set the model name
- setModelId() : AbstractAdapter
- Set the model ID
- setRoute() : AbstractAdapter
- Set the route
- setSendClient() : Http
- Set the send stream
- setStateData() : AbstractAdapter
- Set the final state data
- setUserId() : AbstractAdapter
- Set the user ID
- setUsername() : AbstractAdapter
- Set the username
Constants
CREATED
Constants for action states
public
int
CREATED
= 'created'
DELETED
public
mixed
DELETED
= 'deleted'
UPDATED
public
mixed
UPDATED
= 'updated'
Properties
$action
Action (created, updated, deleted)
protected
string|null
$action
= null
$domain
Domain
protected
string|null
$domain
= null
$fetchClient
Client to fetch the audit results
protected
Client|null
$fetchClient
= null
$metadata
Metadata
protected
array<string|int, mixed>
$metadata
= []
$method
Method
protected
string|null
$method
= null
$model
Model name
protected
string|null
$model
= null
$modelId
Model ID
protected
int|string|null
$modelId
= null
$modified
Modified model state differences
protected
array<string|int, mixed>
$modified
= []
$original
Original model state differences
protected
array<string|int, mixed>
$original
= []
$route
Route
protected
string|null
$route
= null
$sendClient
Client to send the audit results
protected
Client|null
$sendClient
= null
$stateData
Final state data
protected
array<string|int, mixed>
$stateData
= []
$userId
User ID
protected
int|string|null
$userId
= null
$username
Username
protected
string|null
$username
= null
Methods
__construct()
Constructor
public
__construct(Client $sendClient[, Client|null $fetchClient = null ]) : mixed
Instantiate the HTTP adapter object
Parameters
addMetadata()
Add to the metadata
public
addMetadata(string $name, mixed $value) : AbstractAdapter
Parameters
- $name : string
- $value : mixed
Return values
AbstractAdaptergetAction()
Get the action
public
getAction() : string|null
Return values
string|nullgetDomain()
Get the domain
public
getDomain() : string|null
Return values
string|nullgetFetchClient()
Get the fetch stream
public
getFetchClient() : Client
Return values
ClientgetFetchedResult()
Get the fetched result
public
getFetchedResult() : mixed
getMetadata()
Get the metadata
public
getMetadata([string|null $name = null ]) : mixed
Parameters
- $name : string|null = null
getMethod()
Get the method
public
getMethod() : string|null
Return values
string|nullgetModel()
Get the model name
public
getModel() : string|null
Return values
string|nullgetModelId()
Get the model ID
public
getModelId() : int|string|null
Return values
int|string|nullgetModified()
Get the modified model state differences
public
getModified() : array<string|int, mixed>
Return values
array<string|int, mixed>getOriginal()
Get the original model state differences
public
getOriginal() : array<string|int, mixed>
Return values
array<string|int, mixed>getRoute()
Get the route
public
getRoute() : string|null
Return values
string|nullgetSendClient()
Get the send stream
public
getSendClient() : Client
Return values
ClientgetSnapshot()
Get model snapshot by ID
public
getSnapshot(int|string $id[, bool $post = false ]) : array<string|int, mixed>
Parameters
- $id : int|string
- $post : bool = false
Return values
array<string|int, mixed>getStateByDate()
Get model state by date
public
getStateByDate(string $from[, string|null $backTo = null ]) : array<string|int, mixed>
Parameters
- $from : string
- $backTo : string|null = null
Return values
array<string|int, mixed>getStateById()
Get model state by ID
public
getStateById(int|string $id[, bool $asQuery = false ]) : array<string|int, mixed>
Parameters
- $id : int|string
- $asQuery : bool = false
Return values
array<string|int, mixed>getStateByModel()
Get model state by model
public
getStateByModel(string $model[, int|string|null $modelId = null ]) : array<string|int, mixed>
Parameters
- $model : string
- $modelId : int|string|null = null
Return values
array<string|int, mixed>getStateByTimestamp()
Get model state by timestamp
public
getStateByTimestamp(string $from[, string|null $backTo = null ]) : array<string|int, mixed>
Parameters
- $from : string
- $backTo : string|null = null
Return values
array<string|int, mixed>getStateData()
Get the final state
public
getStateData([string|null $name = null ]) : mixed
Parameters
- $name : string|null = null
getStates()
Get model states
public
getStates([array<string|int, mixed> $fields = [] ]) : array<string|int, mixed>
Parameters
- $fields : array<string|int, mixed> = []
Return values
array<string|int, mixed>getUserId()
Get the user ID
public
getUserId() : int|string|null
Return values
int|string|nullgetUsername()
Get the username
public
getUsername() : string|null
Return values
string|nullhasDiff()
Check if the model states are different
public
hasDiff() : bool
Return values
boolhasFetchClient()
Determine if the adapter has a fetch stream
public
hasFetchClient() : bool
Return values
boolhasMetadata()
Determine if there is metadata
public
hasMetadata([string|null $name = null ]) : bool
Parameters
- $name : string|null = null
Return values
boolhasStateData()
Determine if there is final state data
public
hasStateData([string|null $name = null ]) : bool
Parameters
- $name : string|null = null
Return values
boolprepareData()
Prepare data
public
prepareData([bool $jsonEncode = true ]) : array<string|int, mixed>
Parameters
- $jsonEncode : bool = true
Return values
array<string|int, mixed>resolveDiff()
Resolve the differences in values between the model states
public
resolveDiff([array<string|int, mixed> $old = [] ][, array<string|int, mixed> $new = [] ][, bool $state = true ]) : AbstractAdapter
Parameters
- $old : array<string|int, mixed> = []
- $new : array<string|int, mixed> = []
- $state : bool = true
Return values
AbstractAdaptersend()
Send the results of the audit
public
send() : Response
Tags
Return values
ResponsesetDiff()
Set the differences in values between the model states (that have already been processed)
public
setDiff([array<string|int, mixed> $old = [] ][, array<string|int, mixed> $new = [] ]) : AbstractAdapter
Parameters
- $old : array<string|int, mixed> = []
- $new : array<string|int, mixed> = []
Return values
AbstractAdaptersetDomain()
Set the domain
public
setDomain(string $domain) : AbstractAdapter
Parameters
- $domain : string
Return values
AbstractAdaptersetFetchClient()
Set the fetch stream
public
setFetchClient(Client $fetchClient) : Http
Parameters
- $fetchClient : Client
Return values
HttpsetMetadata()
Set the metadata
public
setMetadata(array<string|int, mixed> $metadata) : AbstractAdapter
Parameters
- $metadata : array<string|int, mixed>
Return values
AbstractAdaptersetMethod()
Set the method
public
setMethod(string $method) : AbstractAdapter
Parameters
- $method : string
Return values
AbstractAdaptersetModel()
Set the model name
public
setModel(string $model) : AbstractAdapter
Parameters
- $model : string
Return values
AbstractAdaptersetModelId()
Set the model ID
public
setModelId(int|string $modelId) : AbstractAdapter
Parameters
- $modelId : int|string
Return values
AbstractAdaptersetRoute()
Set the route
public
setRoute(string $route) : AbstractAdapter
Parameters
- $route : string
Return values
AbstractAdaptersetSendClient()
Set the send stream
public
setSendClient(Client $sendClient) : Http
Parameters
- $sendClient : Client
Return values
HttpsetStateData()
Set the final state data
public
setStateData(array<string|int, mixed> $state) : AbstractAdapter
Parameters
- $state : array<string|int, mixed>
Return values
AbstractAdaptersetUserId()
Set the user ID
public
setUserId(int|string $userId) : AbstractAdapter
Parameters
- $userId : int|string
Return values
AbstractAdaptersetUsername()
Set the username
public
setUsername(string $username) : AbstractAdapter
Parameters
- $username : string