PHP Class PrivateBin\Data\AbstractData

Abstract model for PrivateBin data access, implemented as a singleton.
ファイルを表示 Open project: privatebin/privatebin

Protected Properties

Property Type Description
$_instance AbstractData singleton instance

Public Methods

Method Description
create ( string $pasteid, array $paste ) : boolean Create a paste.
createComment ( string $pasteid, string $parentid, string $commentid, array $comment ) : boolean Create a comment in a paste.
delete ( string $pasteid ) : void Delete a paste and its discussion.
exists ( string $pasteid ) : boolean Test if a paste exists.
existsComment ( string $pasteid, string $parentid, string $commentid ) : boolean Test if a comment exists.
getInstance ( array $options ) : privatebin_abstract get instance of singleton
purge ( integer $batchsize ) : void Perform a purge of old pastes, at most the given batchsize is deleted.
read ( string $pasteid ) : stdClas\stdClass | false Read a paste.
readComments ( string $pasteid ) : array Read all comments of paste.

Protected Methods

Method Description
__construct ( ) enforce singleton, disable constructor
_getExpiredPastes ( integer $batchsize ) : array Returns up to batch size number of paste ids that have expired
getOpenSlot ( array &$comments, integer | string $postdate ) : integer | string Get next free slot for comment from postdate.

Private Methods

Method Description
__clone ( ) enforce singleton, disable cloning

Method Details

__construct() protected method

Instantiate using {@link getInstance()}, privatebin is a singleton object.
protected __construct ( )

_getExpiredPastes() abstract protected method

Returns up to batch size number of paste ids that have expired
abstract protected _getExpiredPastes ( integer $batchsize ) : array
$batchsize integer
return array

create() abstract public method

Create a paste.
abstract public create ( string $pasteid, array $paste ) : boolean
$pasteid string
$paste array
return boolean

createComment() abstract public method

Create a comment in a paste.
abstract public createComment ( string $pasteid, string $parentid, string $commentid, array $comment ) : boolean
$pasteid string
$parentid string
$commentid string
$comment array
return boolean

delete() abstract public method

Delete a paste and its discussion.
abstract public delete ( string $pasteid ) : void
$pasteid string
return void

exists() abstract public method

Test if a paste exists.
abstract public exists ( string $pasteid ) : boolean
$pasteid string
return boolean

existsComment() abstract public method

Test if a comment exists.
abstract public existsComment ( string $pasteid, string $parentid, string $commentid ) : boolean
$pasteid string
$parentid string
$commentid string
return boolean

getInstance() public static method

get instance of singleton
public static getInstance ( array $options ) : privatebin_abstract
$options array
return privatebin_abstract

getOpenSlot() protected method

Get next free slot for comment from postdate.
protected getOpenSlot ( array &$comments, integer | string $postdate ) : integer | string
$comments array
$postdate integer | string
return integer | string

purge() public method

Perform a purge of old pastes, at most the given batchsize is deleted.
public purge ( integer $batchsize ) : void
$batchsize integer
return void

read() abstract public method

Read a paste.
abstract public read ( string $pasteid ) : stdClas\stdClass | false
$pasteid string
return stdClas\stdClass | false

readComments() abstract public method

Read all comments of paste.
abstract public readComments ( string $pasteid ) : array
$pasteid string
return array

Property Details

$_instance protected_oe static_oe property

singleton instance
protected static AbstractData,PrivateBin\Data $_instance
return AbstractData