CommentSnippet
extends Part
in package
This file is generated from spec/discovery.json (YouTube Data API v3, revision 20260924) by tools/generate.php. Do not edit it by hand - run `composer spec:build` instead.
Basic details about a comment, such as its author and text.
Tags
Table of Contents
Constants
- MODERATION_STATUS_HELD_FOR_REVIEW : mixed = 'heldForReview'
- The comment is awaiting review by a moderator.
- MODERATION_STATUS_LIKELY_SPAM : mixed = 'likelySpam'
- A `moderationStatus` of `likelySpam`.
- MODERATION_STATUS_PUBLISHED : mixed = 'published'
- The comment is available for public display.
- MODERATION_STATUS_REJECTED : mixed = 'rejected'
- The comment is unfit for display.
- VIEWER_RATING_DISLIKE : mixed = 'dislike'
- The entity is disliked.
- VIEWER_RATING_LIKE : mixed = 'like'
- The entity is liked.
- VIEWER_RATING_NONE : mixed = 'none'
- The entity has not been rated.
Properties
- $authorChannelId : CommentSnippetAuthorChannelId|null
- $authorChannelUrl : string|null
- $authorDisplayName : string|null
- $authorProfileImageUrl : string|null
- $canRate : bool|null
- $channelId : string|null
- $likeCount : int|null
- $moderationStatus : string|null
- $parentId : string|null
- $publishedAt : CarbonImmutable|null
- $textDisplay : string|null
- $textOriginal : string|null
- $updatedAt : CarbonImmutable|null
- $videoId : string|null
- $viewerRating : string|null
- $casts : array<string, string>
- Attribute name => type token (`"LiveChatMessageSnippet"`, `"Array of Thumbnail"`, `"Map of VideoLocalization"`), used to hydrate nested objects into parts.
- $dates : array<int, string>
- Attribute names holding RFC 3339 timestamps, read back as {@see CarbonImmutable}. They are stored and serialised as the strings YouTube sent.
- $youtube : ?YouTube
Methods
- __construct() : mixed
- __debugInfo() : array<string, mixed>
- __get() : mixed
- __isset() : bool
- __set() : void
- __toString() : string
- __unset() : void
- attributeExists() : bool
- fill() : void
- getAttribute() : mixed
- getCasts() : array<string, string>
- getDates() : array<int, string>
- getRawAttribute() : mixed
- Reads straight from the attribute bag, skipping the `get{Key}Attribute` hook.
- getRawAttributes() : array<string, mixed>
- getYouTube() : YouTube
- The client this part came from.
- jsonSerialize() : array<string, mixed>
- The payload this part would be sent back to YouTube as: nested parts and collections flattened, timestamps as RFC 3339 strings.
- offsetExists() : bool
- offsetGet() : mixed
- offsetSet() : void
- offsetUnset() : void
- setAttribute() : void
- factory() : Factory
- Builds another part from the same client - for nested objects.
- setRawAttribute() : void
- Writes straight to the attribute bag, skipping the `set{Key}Attribute` hook and any cast. For use *inside* a mutator, which would otherwise have no way to store its shaped value without recursing through {@see setAttribute()}.
Constants
MODERATION_STATUS_HELD_FOR_REVIEW
The comment is awaiting review by a moderator.
public
mixed
MODERATION_STATUS_HELD_FOR_REVIEW
= 'heldForReview'
MODERATION_STATUS_LIKELY_SPAM
A `moderationStatus` of `likelySpam`.
public
mixed
MODERATION_STATUS_LIKELY_SPAM
= 'likelySpam'
MODERATION_STATUS_PUBLISHED
The comment is available for public display.
public
mixed
MODERATION_STATUS_PUBLISHED
= 'published'
MODERATION_STATUS_REJECTED
The comment is unfit for display.
public
mixed
MODERATION_STATUS_REJECTED
= 'rejected'
VIEWER_RATING_DISLIKE
The entity is disliked.
public
mixed
VIEWER_RATING_DISLIKE
= 'dislike'
VIEWER_RATING_LIKE
The entity is liked.
public
mixed
VIEWER_RATING_LIKE
= 'like'
VIEWER_RATING_NONE
The entity has not been rated.
public
mixed
VIEWER_RATING_NONE
= 'none'
Properties
$authorChannelId
public
CommentSnippetAuthorChannelId|null
$authorChannelId
$authorChannelUrl
public
string|null
$authorChannelUrl
Link to the author's YouTube channel, if any.
$authorDisplayName
public
string|null
$authorDisplayName
The name of the user who posted the comment.
$authorProfileImageUrl
public
string|null
$authorProfileImageUrl
The URL for the avatar of the user who posted the comment.
$canRate
public
bool|null
$canRate
Whether the current viewer can rate this comment.
$channelId
public
string|null
$channelId
The id of the corresponding YouTube channel. In case of a channel comment this is the channel the comment refers to. In case of a video or post comment it's the video/post's channel.
$likeCount
public
int|null
$likeCount
The total number of likes this comment has received.
$moderationStatus
public
string|null
$moderationStatus
The comment's moderation status. Will not be set if the comments were
requested through the id filter. One of the MODERATION_STATUS_* constants.
$parentId
public
string|null
$parentId
The unique id of the top-level comment, only set for replies.
$publishedAt
public
CarbonImmutable|null
$publishedAt
The date and time when the comment was originally published.
$textDisplay
public
string|null
$textDisplay
The comment's text. The format is either plain text or HTML dependent on what has been requested. Even the plain text representation may differ from the text originally posted in that it may replace video links with video titles etc.
$textOriginal
public
string|null
$textOriginal
The comment's original raw text as initially posted or last updated. The original text will only be returned if it is accessible to the viewer, which is only guaranteed if the viewer is the comment's author.
$updatedAt
public
CarbonImmutable|null
$updatedAt
The date and time when the comment was last updated.
$videoId
public
string|null
$videoId
The ID of the video the comment refers to, if any.
$viewerRating
public
string|null
$viewerRating
The rating the viewer has given to this comment. For the time being this
will never return RATE_TYPE_DISLIKE and instead return RATE_TYPE_NONE. This may change in the future. One of
the VIEWER_RATING_* constants.
$casts
Attribute name => type token (`"LiveChatMessageSnippet"`, `"Array of Thumbnail"`, `"Map of VideoLocalization"`), used to hydrate nested objects into parts.
protected
array<string, string>
$casts
= ['authorChannelId' => 'CommentSnippetAuthorChannelId']
$dates
Attribute names holding RFC 3339 timestamps, read back as {@see CarbonImmutable}. They are stored and serialised as the strings YouTube sent.
protected
array<int, string>
$dates
= ['publishedAt', 'updatedAt']
$youtube read-only
protected
?YouTube
$youtube
= null
Methods
__construct()
public
__construct([YouTube|null $youtube = null ][, array<string, mixed>|object $attributes = [] ]) : mixed
Parameters
- $youtube : YouTube|null = null
-
The client, for behaviour that calls the API.
- $attributes : array<string, mixed>|object = []
__debugInfo()
public
__debugInfo() : array<string, mixed>
Return values
array<string, mixed>__get()
public
__get(string $name) : mixed
Parameters
- $name : string
__isset()
public
__isset(string $name) : bool
Parameters
- $name : string
Return values
bool__set()
public
__set(string $name, mixed $value) : void
Parameters
- $name : string
- $value : mixed
__toString()
public
__toString() : string
Return values
string__unset()
public
__unset(string $name) : void
Parameters
- $name : string
attributeExists()
public
attributeExists(string $key) : bool
Parameters
- $key : string
Return values
boolfill()
public
fill(array<string, mixed> $attributes) : void
Parameters
- $attributes : array<string, mixed>
getAttribute()
public
getAttribute(string $key) : mixed
Parameters
- $key : string
getCasts()
public
getCasts() : array<string, string>
Return values
array<string, string>getDates()
public
getDates() : array<int, string>
Return values
array<int, string>getRawAttribute()
Reads straight from the attribute bag, skipping the `get{Key}Attribute` hook.
public
getRawAttribute(string $key) : mixed
Parameters
- $key : string
getRawAttributes()
public
getRawAttributes() : array<string, mixed>
Return values
array<string, mixed>getYouTube()
The client this part came from.
public
getYouTube() : YouTube
Tags
Return values
YouTubejsonSerialize()
The payload this part would be sent back to YouTube as: nested parts and collections flattened, timestamps as RFC 3339 strings.
public
jsonSerialize() : array<string, mixed>
Return values
array<string, mixed>offsetExists()
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
Return values
booloffsetGet()
public
offsetGet(mixed $offset) : mixed
Parameters
- $offset : mixed
offsetSet()
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
- $value : mixed
offsetUnset()
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
setAttribute()
public
setAttribute(string $key, mixed $value) : void
Parameters
- $key : string
- $value : mixed
factory()
Builds another part from the same client - for nested objects.
protected
factory() : Factory
Return values
FactorysetRawAttribute()
Writes straight to the attribute bag, skipping the `set{Key}Attribute` hook and any cast. For use *inside* a mutator, which would otherwise have no way to store its shaped value without recursing through {@see setAttribute()}.
protected
setRawAttribute(string $key, mixed $value) : void
Parameters
- $key : string
- $value : mixed