\PrivateBin\ModelPaste

Paste

Model of a PrivateBin paste.

Summary

Methods
Properties
Constants
__construct()
getId()
setId()
setData()
get()
store()
delete()
exists()
isValidId()
getComment()
getComments()
getDeleteToken()
setAttachment()
setAttachmentName()
setExpiration()
setBurnafterreading()
setOpendiscussion()
setFormatter()
isBurnafterreading()
isOpendiscussion()
No public properties found
No constants found
No protected methods found
$_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 : \stdClass

Instance data.

Type

\stdClass

Methods

getId()

getId() : string

Get ID.

Returns

string

setId()

setId(string  $id) 

Set ID.

Parameters

string $id

Throws

\Exception

setData()

setData(string  $data) 

Set data and recalculate ID.

Parameters

string $data

Throws

\Exception

get()

get() : \PrivateBin\Model\stdClass

Get paste data.

Throws

\Exception

Returns

\PrivateBin\Model\stdClass

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 = null) : \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

setAttachment()

setAttachment(string  $attachment) 

Set paste's attachment.

Parameters

string $attachment

Throws

\Exception

setAttachmentName()

setAttachmentName(string  $attachmentname) 

Set paste's attachment name.

Parameters

string $attachmentname

Throws

\Exception

setExpiration()

setExpiration(string  $expiration) 

Set paste expiration.

Parameters

string $expiration

setBurnafterreading()

setBurnafterreading(string  $burnafterreading = '1') 

Set paste's burn-after-reading type.

Parameters

string $burnafterreading

Throws

\Exception

setOpendiscussion()

setOpendiscussion(string  $opendiscussion = '1') 

Set paste's discussion state.

Parameters

string $opendiscussion

Throws

\Exception

setFormatter()

setFormatter(string  $format) 

Set paste's format.

Parameters

string $format

Throws

\Exception

isBurnafterreading()

isBurnafterreading() : boolean

Check if paste is of burn-after-reading type.

Throws

\Exception

Returns

boolean

isOpendiscussion()

isOpendiscussion() : boolean

Check if paste has discussions enabled.

Throws

\Exception

Returns

boolean