Constants

CREATED

CREATED

Constants for action states

UPDATED

UPDATED

DELETED

DELETED

Properties

$model

$model : string

Model name

Type

string

$modelId

$modelId : integer

Model ID

Type

integer

$action

$action : string

Action (created, updated, deleted)

Type

string

$original

$original : array

Original model state differences

Type

array

$modified

$modified : array

Modified model state differences

Type

array

$username

$username : string

Username

Type

string

$userId

$userId : integer

User ID

Type

integer

$domain

$domain : string

Domain

Type

string

$route

$route : string

Route

Type

string

$method

$method : string

Method

Type

string

$metadata

$metadata : array

Metadata

Type

array

$folder

$folder : string

Folder to store the audit results

Type

string

$prefix

$prefix : string

File prefix

Type

string

Methods

setModel()

setModel(string  $model) : self

Set the model name

Parameters

string $model

Returns

self

setModelId()

setModelId(integer  $modelId) : self

Set the model ID

Parameters

integer $modelId

Returns

self

getModel()

getModel() : string

Get the model name

Returns

string

getModelId()

getModelId() : integer

Get the model ID

Returns

integer

getAction()

getAction() : string

Get the action

Returns

string

getOriginal()

getOriginal() : array

Get the original model state differences

Returns

array

getModified()

getModified() : array

Get the modified model state differences

Returns

array

setUsername()

setUsername(string  $username) : self

Set the username

Parameters

string $username

Returns

self

setUserId()

setUserId(integer  $userId) : self

Set the user ID

Parameters

integer $userId

Returns

self

setDomain()

setDomain(string  $domain) : self

Set the domain

Parameters

string $domain

Returns

self

setRoute()

setRoute(string  $route) : self

Set the route

Parameters

string $route

Returns

self

setMethod()

setMethod(string  $method) : self

Set the method

Parameters

string $method

Returns

self

setMetadata()

setMetadata(array  $metadata) : self

Set the metadata

Parameters

array $metadata

Returns

self

addMetadata()

addMetadata(string  $name, mixed  $value) : self

Add to the metadata

Parameters

string $name
mixed $value

Returns

self

getUsername()

getUsername() : string

Get the username

Returns

string

getUserId()

getUserId() : integer

Get the user ID

Returns

integer

getDomain()

getDomain() : string

Get the domain

Returns

string

getRoute()

getRoute() : string

Get the route

Returns

string

getMethod()

getMethod() : string

Get the method

Returns

string

hasMetadata()

hasMetadata(string  $name = null) : boolean

Determine if there is metadata

Parameters

string $name

Returns

boolean

getMetadata()

getMetadata(string  $name = null) : mixed

Get the metadata

Parameters

string $name

Returns

mixed

setDiff()

setDiff(array  $old = array(), array  $new = array()) : self

Set the differences in values between the model states (that have already been processed)

Parameters

array $old
array $new

Returns

self

resolveDiff()

resolveDiff(array  $old = array(), array  $new = array()) : self

Resolve the differences in values between the model states

Parameters

array $old
array $new

Returns

self

hasDiff()

hasDiff() : boolean

Check if the model states are different

Returns

boolean

send()

send() : string

Send the results of the audit

Throws

\Pop\Audit\Adapter\Exception

Returns

string

getStates()

getStates(string  $sort = 'DESC', integer  $limit = null, integer  $offset = null) : array

Get model states

Parameters

string $sort
integer $limit
integer $offset

Returns

array

getStateById()

getStateById(integer  $id) : array

Get model state by ID

Parameters

integer $id

Returns

array

getStateByModel()

getStateByModel(string  $model, integer  $modelId = null) : array

Get model state by model

Parameters

string $model
integer $modelId

Throws

\Pop\Audit\Adapter\Exception

Returns

array

getStateByTimestamp()

getStateByTimestamp(string  $from, string  $backTo = null) : array

Get model state by timestamp

Parameters

string $from
string $backTo

Returns

array

getStateByDate()

getStateByDate(string  $from, string  $backTo = null) : array

Get model state by date

Parameters

string $from
string $backTo

Returns

array

getSnapshot()

getSnapshot(integer  $id, boolean  $post = false) : array

Get model snapshot by ID

Parameters

integer $id
boolean $post

Returns

array

__construct()

__construct(string  $folder, string  $prefix = 'pop-audit-') 

Constructor

Instantiate the file adapter object

Parameters

string $folder
string $prefix

Throws

\Pop\Audit\Adapter\Exception

getFolder()

getFolder() : string

Get the folder

Returns

string

getPrefix()

getPrefix() : string

Get the prefix

Returns

string

getId()

getId(string  $filename) : string

Get ID from filename

Parameters

string $filename

Throws

\Pop\Audit\Adapter\Exception

Returns

string

decode()

decode(string  $filename) : array

Decode the audit file

Parameters

string $filename

Throws

\Pop\Audit\Adapter\Exception

Returns

array