\PrivateBin\ModelPaste

Paste

Model of a PrivateBin paste.

Summary

Methods
Properties
Constants
__construct()
getId()
setId()
setData()
get()
store()
delete()
exists()
isValidId()
getComment()
getComments()
getDeleteToken()
isOpendiscussion()
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 paste data.

Throws

\Exception

Returns

array

store()

store()

Store the paste's data.

Throws

\Exception

delete()

delete()

Delete the paste.

Throws

\Exception

exists()

exists(): boolean

Test if paste exists in store.

Returns

boolean

isValidId()

isValidId(string  $id): boolean

Validate ID.

Parameters

string $id

Returns

boolean

getComment()

getComment(string  $parentId,string  $commentId = ''): \PrivateBin\Model\Comment

Get a comment, optionally a specific instance.

Parameters

string $parentId
string $commentId

Throws

\Exception

Returns

\PrivateBin\Model\Comment

getComments()

getComments(): array

Get all comments, if any.

Returns

array

getDeleteToken()

getDeleteToken(): string

Generate the "delete" token.

The token is the hmac of the pastes ID signed with the server salt. The paste can be deleted by calling: https://example.com/privatebin/?pasteid=&deletetoken=

Returns

string

isOpendiscussion()

isOpendiscussion(): boolean

Check if paste has discussions enabled.

Throws

\Exception

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