Nextcloud PHP API (stable18)

IComment

Interface IComment

This class represents a comment

Tags
since
9.0.0

Table of Contents

MAX_MESSAGE_LENGTH  = 1000
getActorId()  : string
returns the actor ID
getActorType()  : string
returns the actor type
getChildrenCount()  : int
returns the number of children
getCreationDateTime()  : DateTime
returns the creation date of the comment.
getId()  : string
returns the ID of the comment
getLatestChildDateTime()  : DateTime
returns the date of the most recent child
getMentions()  : array
returns an array containing mentions that are included in the comment
getMessage()  : string
returns the message of the comment
getObjectId()  : string
returns the object id the comment is attached to
getObjectType()  : string
returns the object type the comment is attached to
getParentId()  : string
returns the parent ID of the comment
getTopmostParentId()  : string
returns the topmost parent ID of the comment
getVerb()  : string
returns the verb of the comment
setActor()  : IComment
sets (overwrites) the actor type and id
setChildrenCount()  : IComment
sets the number of children
setCreationDateTime()  : IComment
sets the creation date of the comment and returns itself
setId()  : IComment
sets the ID of the comment and returns itself
setLatestChildDateTime()  : IComment
sets the date of the most recent child
setMessage()  : IComment
sets the message of the comment and returns itself
setObject()  : IComment
sets (overwrites) the object of the comment
setParentId()  : IComment
sets the parent ID and returns itself
setTopmostParentId()  : IComment
sets the topmost parent ID and returns itself
setVerb()  : IComment
sets the verb of the comment, e.g. 'comment' or 'like'

Constants

MAX_MESSAGE_LENGTH

public mixed MAX_MESSAGE_LENGTH = 1000

Methods

getActorId()

returns the actor ID

public getActorId() : string
Tags
since
9.0.0
Return values
string

getActorType()

returns the actor type

public getActorType() : string
Tags
since
9.0.0
Return values
string

getChildrenCount()

returns the number of children

public getChildrenCount() : int
Tags
since
9.0.0
Return values
int

getCreationDateTime()

returns the creation date of the comment.

public getCreationDateTime() : DateTime

If not explicitly set, it shall default to the time of initialization.

Tags
since
9.0.0
Return values
DateTime

getId()

returns the ID of the comment

public getId() : string

It may return an empty string, if the comment was not stored. It is expected that the concrete Comment implementation gives an ID by itself (e.g. after saving).

Tags
since
9.0.0
Return values
string

getLatestChildDateTime()

returns the date of the most recent child

public getLatestChildDateTime() : DateTime
Tags
since
9.0.0
Return values
DateTime

getMentions()

returns an array containing mentions that are included in the comment

public getMentions() : array
Tags
since
11.0.0

The return array looks like: [ [ 'type' => 'user', 'id' => 'citizen4' ], [ 'type' => 'group', 'id' => 'media' ], … ]

Return values
array

each mention provides a 'type' and an 'id', see example below

getMessage()

returns the message of the comment

public getMessage() : string
Tags
since
9.0.0
Return values
string

getObjectId()

returns the object id the comment is attached to

public getObjectId() : string
Tags
since
9.0.0
Return values
string

getObjectType()

returns the object type the comment is attached to

public getObjectType() : string
Tags
since
9.0.0
Return values
string

getParentId()

returns the parent ID of the comment

public getParentId() : string
Tags
since
9.0.0
Return values
string

getTopmostParentId()

returns the topmost parent ID of the comment

public getTopmostParentId() : string
Tags
since
9.0.0
Return values
string

getVerb()

returns the verb of the comment

public getVerb() : string
Tags
since
9.0.0
Return values
string

setActor()

sets (overwrites) the actor type and id

public setActor(string $actorType, string $actorId) : IComment
Parameters
$actorType : string

e.g. 'users'

$actorId : string

e.g. 'zombie234'

Tags
since
9.0.0
Return values
IComment

setChildrenCount()

sets the number of children

public setChildrenCount(int $count) : IComment
Parameters
$count : int
Tags
since
9.0.0
Return values
IComment

setCreationDateTime()

sets the creation date of the comment and returns itself

public setCreationDateTime(DateTime $dateTime) : IComment
Parameters
$dateTime : DateTime
Tags
since
9.0.0
Return values
IComment

setId()

sets the ID of the comment and returns itself

public setId(string $id) : IComment

It is only allowed to set the ID only, if the current id is an empty string (which means it is not stored in a database, storage or whatever the concrete implementation does), or vice versa. Changing a given ID is not permitted and must result in an IllegalIDChangeException.

Parameters
$id : string
Tags
throws
IllegalIDChangeException
since
9.0.0
Return values
IComment

setLatestChildDateTime()

sets the date of the most recent child

public setLatestChildDateTime(DateTime $dateTime) : IComment
Parameters
$dateTime : DateTime
Tags
since
9.0.0
Return values
IComment

setMessage()

sets the message of the comment and returns itself

public setMessage(string $message[, int $maxLength = self::MAX_MESSAGE_LENGTH ]) : IComment

When the given message length exceeds MAX_MESSAGE_LENGTH an MessageTooLongException shall be thrown.

Parameters
$message : string
$maxLength : int = self::MAX_MESSAGE_LENGTH
Tags
throws
MessageTooLongException
since
9.0.0
  • $maxLength added in 16.0.2
Return values
IComment

setObject()

sets (overwrites) the object of the comment

public setObject(string $objectType, string $objectId) : IComment
Parameters
$objectType : string

e.g. 'files'

$objectId : string

e.g. '16435'

Tags
since
9.0.0
Return values
IComment

setParentId()

sets the parent ID and returns itself

public setParentId(string $parentId) : IComment
Parameters
$parentId : string
Tags
since
9.0.0
Return values
IComment

setTopmostParentId()

sets the topmost parent ID and returns itself

public setTopmostParentId(string $id) : IComment
Parameters
$id : string
Tags
since
9.0.0
Return values
IComment

setVerb()

sets the verb of the comment, e.g. 'comment' or 'like'

public setVerb(string $verb) : IComment
Parameters
$verb : string
Tags
since
9.0.0
Return values
IComment

Search results