MetaFox

CommentRepository extends AbstractRepository
in package
implements CommentRepositoryInterface Uses HasApprove, HasFilterTagUserTrait

Class CommentRepository.

Tags
SuppressWarnings

(PHPMD)

Table of Contents

Interfaces

CommentRepositoryInterface
Interface Comment.

Constants

NEWEST_SORT_OPERATOR  = '>'
OLDEST_SORT_OPERATOR  = '<'
REGEX_LINK  = '/(http[s]?:\\/\\/(www\\.)?|ftp:\\/\\/(www\\.)?|www\\.){1}([0-9A-Za-z-\\-\\.@:%_\\+~#=]+)+((\\.[a-zA-Z])*)(\\/([0-9A-Za-z-\\-\\.@:%_\\+~#=\\?,])*)*/'

Properties

$disableSponsor  : mixed
$skipPresenter  : mixed

Methods

approve()  : bool
buildQueryScopes()  : mixed
checkSpam()  : bool
cleanContent()  : string|null
cleanTitle()  : string|null
createComment()  : Comment
createMany()  : bool
deleteCommentById()  : array<string, mixed>
deleteCommentByParentId()  : bool
fallbackMentionUsers()  : array<string|int, mixed>
fallbackTagUsers()  : array<string|int, mixed>
filterMentionUsers()  : array<string|int, mixed>
filterTagUsers()  : array<string|int, mixed>
find()  : Comment
getModel()  : Comment
getRelatedCommentForItemDetailQuery()  : Builder
getRelatedComments()  : Collection
getRelatedCommentsByType()  : Collection
getRelatedCommentsByTypeQuery()  : Builder
getRelatedCommentsForItemDetail()  : Collection
getRelevantCommentsById()  : Collection|null
getTotalHidden()  : int
getUserContractMorphTypeColumns()  : array<string|int, string>
getUsersCommentByItem()  : array<int, mixed>
hasSponsorView()  : bool
isNoSponsorView()  : bool
isPending()  : bool
likeOperator()  : string
return the case-insensitive LIKE operator bases on the current database driver.
model()  : string
removeLinkPreview()  : bool
removeMentionsFromContent()  : string|null
transformTaggedFriends()  : array<string|int, mixed>
updateComment()  : Comment
viewComment()  : Comment
viewComments()  : Collection
where()  : $this
withUserMorphTypeActiveScope()  : self
buildConditionForViewDetailCommentInMobile()  : void
buildOrderFriend()  : string
commentHistoryRepository()  : CommentHistoryRepositoryInterface
handleIsApproved()  : bool
handleMentionedUsers()  : array<string|int, mixed>
handleTaggedUsers()  : array<string|int, mixed>
mappingComment()  : Collection
buildCommentsQuery()  : Builder
handleCreateAttachment()  : void
handleDeleteAttachment()  : void
validateText()  : void

Constants

public mixed REGEX_LINK = '/(http[s]?:\\/\\/(www\\.)?|ftp:\\/\\/(www\\.)?|www\\.){1}([0-9A-Za-z-\\-\\.@:%_\\+~#=]+)+((\\.[a-zA-Z])*)(\\/([0-9A-Za-z-\\-\\.@:%_\\+~#=\\?,])*)*/'

Properties

Methods

approve()

public approve(User $context, int $id) : bool
Parameters
$context : User
$id : int
Tags
throws
AuthorizationException
Return values
bool

buildQueryScopes()

public buildQueryScopes(mixed $query, mixed $model, mixed $criteria) : mixed
Parameters
$query : mixed
$model : mixed
$criteria : mixed

checkSpam()

public checkSpam(User $user, int $commentId, string $content, int $stickerId, bool $hasPhotoId) : bool
Parameters
$user : User
$commentId : int
$content : string
$stickerId : int
$hasPhotoId : bool
Return values
bool

cleanContent()

public cleanContent(string|null $string) : string|null
Parameters
$string : string|null
Return values
string|null

cleanTitle()

public cleanTitle(string|null $string) : string|null
Parameters
$string : string|null
Return values
string|null

createComment()

public createComment(User $context, array<string|int, mixed> $attributes) : Comment
Parameters
$context : User
$attributes : array<string|int, mixed>
Return values
Comment

createMany()

public createMany(array<string|int, mixed> $items) : bool
Parameters
$items : array<string|int, mixed>
Return values
bool

deleteCommentById()

public deleteCommentById(User $context, int $id) : array<string, mixed>
Parameters
$context : User
$id : int
Tags
throws
AuthorizationException
Return values
array<string, mixed>

deleteCommentByParentId()

public deleteCommentByParentId(int $parentId) : bool
Parameters
$parentId : int
Return values
bool

fallbackMentionUsers()

public fallbackMentionUsers(User $context, User $user, array<string|int, mixed> $mentionUserIds) : array<string|int, mixed>
Parameters
$context : User
$user : User
$mentionUserIds : array<string|int, mixed>
Return values
array<string|int, mixed>

fallbackTagUsers()

public fallbackTagUsers(User $context, User $user, array<string|int, mixed> $taggedUserIds) : array<string|int, mixed>
Parameters
$context : User
$user : User
$taggedUserIds : array<string|int, mixed>
Return values
array<string|int, mixed>

filterMentionUsers()

public filterMentionUsers(User $context, User $user, User $owner, array<string|int, mixed> $mentionUserIds) : array<string|int, mixed>
Parameters
$context : User
$user : User
$owner : User
$mentionUserIds : array<string|int, mixed>
Return values
array<string|int, mixed>

filterTagUsers()

public filterTagUsers(User $context, User $user, User $owner, array<string|int, mixed> $taggedUserIds) : array<string|int, mixed>
Parameters
$context : User
$user : User
$owner : User
$taggedUserIds : array<string|int, mixed>
Return values
array<string|int, mixed>

getRelatedCommentForItemDetailQuery()

public getRelatedCommentForItemDetailQuery(User $context, mixed $itemType, mixed $itemId[, array<string|int, mixed> $attributes = [] ]) : Builder
Parameters
$context : User
$itemType : mixed
$itemId : mixed
$attributes : array<string|int, mixed> = []
Return values
Builder

getRelatedCommentsByType()

public getRelatedCommentsByType(User $context, string $itemType, int $itemId[, array<string|int, mixed> $attributes = [] ]) : Collection
Parameters
$context : User
$itemType : string
$itemId : int
$attributes : array<string|int, mixed> = []
Return values
Collection

getRelatedCommentsByTypeQuery()

public getRelatedCommentsByTypeQuery(User $context, string $itemType, int $itemId[, array<string|int, mixed> $attributes = [] ]) : Builder
Parameters
$context : User
$itemType : string
$itemId : int
$attributes : array<string|int, mixed> = []
Return values
Builder

getRelatedCommentsForItemDetail()

public getRelatedCommentsForItemDetail(User $context, HasTotalComment $content[, int $limit = 6 ][, array<string|int, mixed> $attributes = [] ]) : Collection
Parameters
$context : User
$content : HasTotalComment
$limit : int = 6
$attributes : array<string|int, mixed> = []
Return values
Collection

getRelevantCommentsById()

public getRelevantCommentsById(User $context, int $id[, Entity|null $content = null ][, bool $isFeed = true ]) : Collection|null
Parameters
$context : User
$id : int
$content : Entity|null = null
$isFeed : bool = true
Return values
Collection|null

getUserContractMorphTypeColumns()

public getUserContractMorphTypeColumns() : array<string|int, string>
Return values
array<string|int, string>

getUsersCommentByItem()

public getUsersCommentByItem(User $context, array<string|int, mixed> $attributes) : array<int, mixed>
Parameters
$context : User
$attributes : array<string|int, mixed>
Tags
inheritDoc
Return values
array<int, mixed>

hasSponsorView()

public hasSponsorView(array<string|int, mixed> $attributes) : bool
Parameters
$attributes : array<string|int, mixed>
Return values
bool

isNoSponsorView()

public isNoSponsorView(string|null $view) : bool
Parameters
$view : string|null
Return values
bool

likeOperator()

return the case-insensitive LIKE operator bases on the current database driver.

public likeOperator() : string
Return values
string

removeMentionsFromContent()

public removeMentionsFromContent(string|null $content, array<string|int, mixed> $removedIds) : string|null
Parameters
$content : string|null
$removedIds : array<string|int, mixed>
Return values
string|null

transformTaggedFriends()

public transformTaggedFriends(User $context, User $user, User|null $owner, array<string|int, mixed> $taggedFriends[, string|null $content = null ][, HasTaggedFriend|null $item = null ][, bool $removeMentionOnContent = true ]) : array<string|int, mixed>
Parameters
$context : User
$user : User
$owner : User|null
$taggedFriends : array<string|int, mixed>
$content : string|null = null
$item : HasTaggedFriend|null = null
$removeMentionOnContent : bool = true
Return values
array<string|int, mixed>

updateComment()

public updateComment(User $context, int $id, array<string|int, mixed> $attributes) : Comment
Parameters
$context : User
$id : int
$attributes : array<string|int, mixed>
Return values
Comment

viewComments()

public viewComments(User $context, array<string|int, mixed> $attributes) : Collection
Parameters
$context : User
$attributes : array<string|int, mixed>
Return values
Collection

where()

public where(array<string|int, mixed> $params) : $this
Parameters
$params : array<string|int, mixed>
Tags
throws
RepositoryException
Return values
$this

withUserMorphTypeActiveScope()

public withUserMorphTypeActiveScope() : self
Return values
self

buildConditionForViewDetailCommentInMobile()

protected buildConditionForViewDetailCommentInMobile(Builder $query, int|null $commentId) : void
Parameters
$query : Builder
$commentId : int|null

buildOrderFriend()

protected buildOrderFriend(User $context) : string
Parameters
$context : User
Return values
string

handleMentionedUsers()

protected handleMentionedUsers(User $context, User $user, User $owner, array<string|int, mixed> $mentionedUsers, string|null &$content[, bool $removeMentionOnContent = true ]) : array<string|int, mixed>
Parameters
$context : User
$user : User
$owner : User
$mentionedUsers : array<string|int, mixed>
$content : string|null
$removeMentionOnContent : bool = true
Return values
array<string|int, mixed>

handleTaggedUsers()

protected handleTaggedUsers(User $context, User $user, User $owner, array<string|int, mixed> $taggedUsers) : array<string|int, mixed>
Parameters
$context : User
$user : User
$owner : User
$taggedUsers : array<string|int, mixed>
Return values
array<string|int, mixed>

mappingComment()

protected mappingComment(User $context, Collection $comments, mixed $limitChildren) : Collection
Parameters
$context : User
$comments : Collection
$limitChildren : mixed
Return values
Collection

buildCommentsQuery()

private buildCommentsQuery(User $context, array<string, mixed> $attributes) : Builder
Parameters
$context : User
$attributes : array<string, mixed>
Return values
Builder

handleCreateAttachment()

private handleCreateAttachment(Comment $comment, string $itemType[, int $itemId = 0 ][, string $oldText = '' ]) : void
Parameters
$comment : Comment
$itemType : string
$itemId : int = 0
$oldText : string = ''

handleDeleteAttachment()

private handleDeleteAttachment(Comment $comment, string $itemType) : void
Parameters
$comment : Comment
$itemType : string

validateText()

private validateText(Comment $comment, array<string, mixed> $attributes) : void
Parameters
$comment : Comment
$attributes : array<string, mixed>
Tags
throws
ValidationException

        
On this page

Search results