\PrivateBin\ModelAbstractModel

AbstractModel

Abstract model for PrivateBin objects.

Summary

Methods
Properties
Constants
__construct()
getId()
setId()
setData()
get()
store()
delete()
exists()
isValidId()
No public properties found
No constants found
_sanitize()
_validate()
$_id
$_data
$_conf
$_store
N/A
No private methods found
No private properties found
N/A

Properties

$_id

$_id :string

Instance ID.

Type

string

$_data

$_data :array

Instance data.

Type

array

Methods

getId()

getId(): string

Get ID.

Returns

string

setId()

setId(string  $id)

Set ID.

Parameters

string $id

Throws

\Exception

setData()

setData(array  $data)

Set data and recalculate ID.

Parameters

array $data

Throws

\Exception

get()

get(): array

Get instance data.

Returns

array

store()

store()

Store the instance's data.

Throws

\Exception

delete()

delete()

Delete the current instance.

Throws

\Exception

exists()

exists(): boolean

Test if current instance exists in store.

Returns

boolean

isValidId()

isValidId(string  $id): boolean

Validate ID.

Parameters

string $id

Returns

boolean

_sanitize()

_sanitize(array  $data): array

Sanitizes data to conform with current configuration.

Parameters

array $data

Returns

array

_validate()

_validate(array  $data)

Validate data.

Parameters

array $data

Throws

\Exception