Documentation

File extends AbstractAdapter
in package

Auditor file class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2023 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
1.3.0

Table of Contents

CREATED  = 'created'
Constants for action states
DELETED  = 'deleted'
UPDATED  = 'updated'
$action  : string
Action (created, updated, deleted)
$domain  : string
Domain
$folder  : string
Folder to store the audit results
$metadata  : array<string|int, mixed>
Metadata
$method  : string
Method
$model  : string
Model name
$modelId  : int
Model ID
$modified  : array<string|int, mixed>
Modified model state differences
$original  : array<string|int, mixed>
Original model state differences
$prefix  : string
File prefix
$route  : string
Route
$userId  : int
User ID
$username  : string
Username
__construct()  : mixed
Constructor
addMetadata()  : self
Add to the metadata
decode()  : array<string|int, mixed>
Decode the audit file
getAction()  : string
Get the action
getDomain()  : string
Get the domain
getFolder()  : string
Get the folder
getId()  : string
Get ID from filename
getMetadata()  : mixed
Get the metadata
getMethod()  : string
Get the method
getModel()  : string
Get the model name
getModelId()  : int
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
getPrefix()  : string
Get the prefix
getRoute()  : string
Get the route
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
getStates()  : array<string|int, mixed>
Get model states
getUserId()  : int
Get the user ID
getUsername()  : string
Get the username
hasDiff()  : bool
Check if the model states are different
hasMetadata()  : bool
Determine if there is metadata
prepareData()  : array<string|int, mixed>
Prepare data
resolveDiff()  : self
Resolve the differences in values between the model states
send()  : string
Send the results of the audit
setDiff()  : self
Set the differences in values between the model states (that have already been processed)
setDomain()  : self
Set the domain
setMetadata()  : self
Set the metadata
setMethod()  : self
Set the method
setModel()  : self
Set the model name
setModelId()  : self
Set the model ID
setRoute()  : self
Set the route
setUserId()  : self
Set the user ID
setUsername()  : self
Set the username

Constants

Properties

$action

Action (created, updated, deleted)

protected string $action = null

$folder

Folder to store the audit results

protected string $folder = null

$metadata

Metadata

protected array<string|int, mixed> $metadata = []

$modified

Modified model state differences

protected array<string|int, mixed> $modified = []

$original

Original model state differences

protected array<string|int, mixed> $original = []

$prefix

File prefix

protected string $prefix = 'pop-audit-'

Methods

__construct()

Constructor

public __construct(string $folder[, string $prefix = 'pop-audit-' ]) : mixed

Instantiate the file adapter object

Parameters
$folder : string
$prefix : string = 'pop-audit-'
Tags
throws
Exception
Return values
mixed

addMetadata()

Add to the metadata

public addMetadata(string $name, mixed $value) : self
Parameters
$name : string
$value : mixed
Return values
self

decode()

Decode the audit file

public decode(string $filename) : array<string|int, mixed>
Parameters
$filename : string
Tags
throws
Exception
Return values
array<string|int, mixed>

getAction()

Get the action

public getAction() : string
Return values
string

getDomain()

Get the domain

public getDomain() : string
Return values
string

getFolder()

Get the folder

public getFolder() : string
Return values
string

getId()

Get ID from filename

public getId(string $filename) : string
Parameters
$filename : string
Tags
throws
Exception
Return values
string

getMetadata()

Get the metadata

public getMetadata([string $name = null ]) : mixed
Parameters
$name : string = null
Return values
mixed

getMethod()

Get the method

public getMethod() : string
Return values
string

getModel()

Get the model name

public getModel() : string
Return values
string

getModelId()

Get the model ID

public getModelId() : int
Return values
int

getModified()

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>

getPrefix()

Get the prefix

public getPrefix() : string
Return values
string

getRoute()

Get the route

public getRoute() : string
Return values
string

getSnapshot()

Get model snapshot by ID

public getSnapshot(int $id[, bool $post = false ]) : array<string|int, mixed>
Parameters
$id : int
$post : bool = false
Return values
array<string|int, mixed>

getStateByDate()

Get model state by date

public getStateByDate(string $from[, string $backTo = null ]) : array<string|int, mixed>
Parameters
$from : string
$backTo : string = null
Return values
array<string|int, mixed>

getStateById()

Get model state by ID

public getStateById(int $id) : array<string|int, mixed>
Parameters
$id : int
Return values
array<string|int, mixed>

getStateByModel()

Get model state by model

public getStateByModel(string $model[, int $modelId = null ]) : array<string|int, mixed>
Parameters
$model : string
$modelId : int = null
Tags
throws
Exception
Return values
array<string|int, mixed>

getStateByTimestamp()

Get model state by timestamp

public getStateByTimestamp(string $from[, string $backTo = null ]) : array<string|int, mixed>
Parameters
$from : string
$backTo : string = null
Return values
array<string|int, mixed>

getStates()

Get model states

public getStates([string $sort = 'DESC' ][, int $limit = null ][, int $offset = null ]) : array<string|int, mixed>
Parameters
$sort : string = 'DESC'
$limit : int = null
$offset : int = null
Return values
array<string|int, mixed>

getUserId()

Get the user ID

public getUserId() : int
Return values
int

getUsername()

Get the username

public getUsername() : string
Return values
string

hasDiff()

Check if the model states are different

public hasDiff() : bool
Return values
bool

hasMetadata()

Determine if there is metadata

public hasMetadata([string $name = null ]) : bool
Parameters
$name : string = null
Return values
bool

prepareData()

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 = [] ]) : self
Parameters
$old : array<string|int, mixed> = []
$new : array<string|int, mixed> = []
Return values
self

send()

Send the results of the audit

public send() : string
Tags
throws
Exception
Return values
string

setDiff()

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 = [] ]) : self
Parameters
$old : array<string|int, mixed> = []
$new : array<string|int, mixed> = []
Return values
self

setDomain()

Set the domain

public setDomain(string $domain) : self
Parameters
$domain : string
Return values
self

setMetadata()

Set the metadata

public setMetadata(array<string|int, mixed> $metadata) : self
Parameters
$metadata : array<string|int, mixed>
Return values
self

setMethod()

Set the method

public setMethod(string $method) : self
Parameters
$method : string
Return values
self

setModel()

Set the model name

public setModel(string $model) : self
Parameters
$model : string
Return values
self

setModelId()

Set the model ID

public setModelId(int $modelId) : self
Parameters
$modelId : int
Return values
self

setRoute()

Set the route

public setRoute(string $route) : self
Parameters
$route : string
Return values
self

setUserId()

Set the user ID

public setUserId(int $userId) : self
Parameters
$userId : int
Return values
self

setUsername()

Set the username

public setUsername(string $username) : self
Parameters
$username : string
Return values
self

Search results