\PrivateBin\DataAbstractData

AbstractData

Abstract model for PrivateBin data access, implemented as a singleton.

Summary

Methods
Properties
Constants
getInstance()
create()
read()
delete()
exists()
createComment()
readComments()
existsComment()
purge()
No public properties found
No constants found
__construct()
_getExpiredPastes()
getOpenSlot()
$_instance
N/A
__clone()
No private properties found
N/A

Properties

Methods

getInstance()

getInstance(array  $options) : \PrivateBin\Data\AbstractData

get instance of singleton

Parameters

array $options

Returns

\PrivateBin\Data\AbstractData

create()

create(string  $pasteid, array  $paste) : boolean

Create a paste.

Parameters

string $pasteid
array $paste

Returns

boolean

read()

read(string  $pasteid) : \stdClass|false

Read a paste.

Parameters

string $pasteid

Returns

\stdClass|false

delete()

delete(string  $pasteid) 

Delete a paste and its discussion.

Parameters

string $pasteid

exists()

exists(string  $pasteid) : boolean

Test if a paste exists.

Parameters

string $pasteid

Returns

boolean

createComment()

createComment(string  $pasteid, string  $parentid, string  $commentid, array  $comment) : boolean

Create a comment in a paste.

Parameters

string $pasteid
string $parentid
string $commentid
array $comment

Returns

boolean

readComments()

readComments(string  $pasteid) : array

Read all comments of paste.

Parameters

string $pasteid

Returns

array

existsComment()

existsComment(string  $pasteid, string  $parentid, string  $commentid) : boolean

Test if a comment exists.

Parameters

string $pasteid
string $parentid
string $commentid

Returns

boolean

purge()

purge(integer  $batchsize) 

Perform a purge of old pastes, at most the given batchsize is deleted.

Parameters

integer $batchsize

__construct()

__construct() 

enforce singleton, disable constructor

Instantiate using \getInstance(), privatebin is a singleton object.

_getExpiredPastes()

_getExpiredPastes(integer  $batchsize) : array

Returns up to batch size number of paste ids that have expired

Parameters

integer $batchsize

Returns

array

getOpenSlot()

getOpenSlot(array  $comments, integer|string  $postdate) : integer|string

Get next free slot for comment from postdate.

Parameters

array $comments
integer|string $postdate

Returns

integer|string

__clone()

__clone() 

enforce singleton, disable cloning

Instantiate using \getInstance(), privatebin is a singleton object.