Paste
extends AbstractModel
in package
Paste
Model of a PrivateBin paste.
Table of Contents
- $_conf : Configuration
- Configuration.
- $_data : array<string|int, mixed>
- Instance data.
- $_id : string
- Instance ID.
- $_store : AbstractData
- Data storage.
- __construct() : mixed
- Instance constructor.
- delete() : mixed
- Delete the paste.
- exists() : bool
- Test if paste exists in store.
- get() : array<string|int, mixed>
- Get paste data.
- getComment() : Comment
- Get a comment, optionally a specific instance.
- getComments() : array<string|int, mixed>
- Get all comments, if any.
- getDeleteToken() : string
- Generate the "delete" token.
- getId() : string
- Get ID.
- isOpendiscussion() : bool
- Check if paste has discussions enabled.
- isValidId() : bool
- Validate ID.
- setData() : mixed
- Set data and recalculate ID.
- setId() : mixed
- Set ID.
- store() : mixed
- Store the paste's data.
- _sanitize() : array<string|int, mixed>
- Sanitizes data to conform with current configuration.
- _validate() : mixed
- Validate data.
Properties
$_conf
Configuration.
protected
Configuration
$_conf
Tags
$_data
Instance data.
protected
array<string|int, mixed>
$_data
= array('meta' => array())
Tags
$_id
Instance ID.
protected
string
$_id
= ''
Tags
$_store
Data storage.
protected
AbstractData
$_store
Tags
Methods
__construct()
Instance constructor.
public
__construct(Configuration $configuration, AbstractData $storage) : mixed
Parameters
- $configuration : Configuration
- $storage : AbstractData
Tags
Return values
mixed —delete()
Delete the paste.
public
delete() : mixed
Tags
Return values
mixed —exists()
Test if paste exists in store.
public
exists() : bool
Tags
Return values
bool —get()
Get paste data.
public
get() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getComment()
Get a comment, optionally a specific instance.
public
getComment(string $parentId[, string $commentId = '' ]) : Comment
Parameters
- $parentId : string
- $commentId : string = ''
Tags
Return values
Comment —getComments()
Get all comments, if any.
public
getComments() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getDeleteToken()
Generate the "delete" token.
public
getDeleteToken() : string
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=
Tags
Return values
string —getId()
Get ID.
public
getId() : string
Tags
Return values
string —isOpendiscussion()
Check if paste has discussions enabled.
public
isOpendiscussion() : bool
Tags
Return values
bool —isValidId()
Validate ID.
public
static isValidId(string $id) : bool
Parameters
- $id : string
Tags
Return values
bool —setData()
Set data and recalculate ID.
public
setData(array<string|int, mixed> $data) : mixed
Parameters
- $data : array<string|int, mixed>
Tags
Return values
mixed —setId()
Set ID.
public
setId(string $id) : mixed
Parameters
- $id : string
Tags
Return values
mixed —store()
Store the paste's data.
public
store() : mixed
Tags
Return values
mixed —_sanitize()
Sanitizes data to conform with current configuration.
protected
_sanitize(array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —_validate()
Validate data.
protected
_validate(array<string|int, mixed> $data) : mixed
Parameters
- $data : array<string|int, mixed>