MetaFox

PhotoRepository extends AbstractRepository
in package
implements PhotoRepositoryInterface Uses HasFeatured, HasSponsor, HasApprove, HasSponsorInFeed, CollectTotalItemStatTrait, HasFilterTagUserTrait

Class PhotoRepository.

Tags
SuppressWarnings

(PHPMD.CouplingBetweenObjects)

SuppressWarnings

(PHPMD.ExcessiveClassComplexity)

SuppressWarnings

(PHPMD.ExcessiveClassComplexity)

Table of Contents

Interfaces

PhotoRepositoryInterface
Interface PhotoRepositoryInterface.

Properties

$model  : Photo
$disableSponsor  : mixed
$skipPresenter  : mixed

Methods

approve()  : bool
buildQueryScopes()  : mixed
cleanContent()  : string|null
cleanTitle()  : string|null
cleanUpRelationData()  : void
createMany()  : bool
createPhoto()  : array<string|int, int>
deletePhoto()  : array<string, mixed>
deleteTaggedFriend()  : false|int
disableSponsor()  : void
downloadPhoto()  : Photo
enableSponsor()  : void
fallbackMentionUsers()  : array<string|int, mixed>
fallbackTagUsers()  : array<string|int, mixed>
feature()  : bool
filterMentionUsers()  : array<string|int, mixed>
filterTagUsers()  : array<string|int, mixed>
find()  : Photo
findFeature()  : Paginator
findSponsor()  : Paginator
getAlbum()  : Album
getModel()  : Photo
getPhotoByFeedId()  : Paginator
getPhotosByGroupId()  : Collection|null
getPrivacyFromAlbum()  : array<string, mixed>
getRandomSponsoredItems()  : Collection
getSponsoredItem()  : Content|null
getTaggedFriends()  : Collection
getTotalItemByPeriod()  : int
getTotalPendingItemByPeriod()  : int
getUserContractMorphTypeColumns()  : array<string|int, string>
hasSponsorView()  : bool
isFeature()  : bool
isFeedSponsored()  : bool
isNoSponsorView()  : bool
isPending()  : bool
isSponsor()  : bool
likeOperator()  : string
return the case-insensitive LIKE operator bases on the current database driver.
makeParentAvatar()  : array<string, mixed>|null
makeParentCover()  : bool
makeProfileAvatar()  : array<string, mixed>|null
makeProfileCover()  : bool
model()  : string
newModelInstance()  : Photo
removeMentionsFromContent()  : string|null
sponsor()  : bool
sponsorInFeed()  : bool
tagFriend()  : TagFriendModel
tempFileToExistPhoto()  : Photo
tempFileToPhoto()  : Photo
transformTaggedFriends()  : array<string|int, mixed>
unsponsor()  : bool
unsponsorInFeed()  : bool
updateAvatarPath()  : string
updatePhoto()  : Photo
uploadMedias()  : PhotoGroup
viewPhoto()  : Photo
viewPhotos()  : Paginator
viewPhotoSet()  : PhotoGroup
where()  : $this
withUserMorphTypeActiveScope()  : self
getPrivacyForDefaultAlbum()  : array<string|int, mixed>
getPrivacyForNormalAlbum()  : array<string|int, mixed>
getPrivacyForRemovingAlbum()  : array<string|int, mixed>
handleBase64()  : void
handleMentionedUsers()  : array<string|int, mixed>
handleMultipleTagFriends()  : void
handleTaggedFriends()  : bool
handleTaggedUsers()  : array<string|int, mixed>
prepareDataForGroupUpdate()  : void
setContent()  : void
unsetContent()  : mixed
updateGlobalSearch()  : bool|null
uploadProfileCover()  : UploadedFile|null
uploadRawFile()  : StorageFile
applyDisplayPhotoSetting()  : Builder
buildQueryPhotos()  : Builder
categoryRepository()  : CategoryRepositoryInterface
checkPhotoQuota()  : void
checkUserUploadAvatarOrCover()  : bool
getAlbumRepository()  : AlbumRepositoryInterface
photoGroupRepository()  : PhotoGroupRepositoryInterface
userRepository()  : UserRepositoryInterface

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

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

createMany()

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

createPhoto()

public createPhoto(User $context, User $owner, array<string|int, mixed> $attributes[, int $albumType = Album::TIMELINE_ALBUM ][, string|null $typeId = null ]) : array<string|int, int>
Parameters
$context : User
$owner : User
$attributes : array<string|int, mixed>
$albumType : int = Album::TIMELINE_ALBUM
$typeId : string|null = null
Tags
inheritdoc
SuppressWarnings

(PHPMD.CyclomaticComplexity)

SuppressWarnings

(PHPMD.NPathComplexity)

Return values
array<string|int, int>

deletePhoto()

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

deleteTaggedFriend()

public deleteTaggedFriend(User $user, int $tagId) : false|int
Parameters
$user : User
$tagId : int
Tags
throws
AuthorizationException
Return values
false|int

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>

feature()

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

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>

findFeature()

public findFeature([int $limit = 4 ]) : Paginator
Parameters
$limit : int = 4
Return values
Paginator

findSponsor()

public findSponsor([int $limit = 4 ]) : Paginator
Parameters
$limit : int = 4
Return values
Paginator

getPhotoByFeedId()

public getPhotoByFeedId(User $context, int $feedId[, array<string|int, mixed> $attributes = [] ]) : Paginator
Parameters
$context : User
$feedId : int
$attributes : array<string|int, mixed> = []
Return values
Paginator

getPhotosByGroupId()

public getPhotosByGroupId(int $groupId) : Collection|null
Parameters
$groupId : int
Return values
Collection|null

getPrivacyFromAlbum()

public getPrivacyFromAlbum(int|null $albumId, array<string|int, mixed> $attributes[, Photo|null $photo = null ]) : array<string, mixed>
Parameters
$albumId : int|null
$attributes : array<string|int, mixed>
$photo : Photo|null = null
Return values
array<string, mixed>

getRandomSponsoredItems()

public getRandomSponsoredItems(User $context, int $limit[, array<string|int, mixed>|null $loadedItemIds = null ]) : Collection
Parameters
$context : User
$limit : int
$loadedItemIds : array<string|int, mixed>|null = null
Return values
Collection

getSponsoredItem()

public getSponsoredItem(array<string|int, mixed> $notInIds[, int|null $sponsorStart = null ][, array<string|int, mixed> $with = [] ]) : Content|null
Parameters
$notInIds : array<string|int, mixed>
$sponsorStart : int|null = null
$with : array<string|int, mixed> = []
Return values
Content|null

getTaggedFriends()

public getTaggedFriends(User $context, int $photoId) : Collection
Parameters
$context : User
$photoId : int
Tags
throws
AuthorizationException
Return values
Collection

getTotalItemByPeriod()

public getTotalItemByPeriod([Carbon|null $after = null ][, Carbon|null $before = null ]) : int
Parameters
$after : Carbon|null = null
$before : Carbon|null = null
Return values
int

getTotalPendingItemByPeriod()

public getTotalPendingItemByPeriod([Carbon|null $after = null ][, Carbon|null $before = null ][, array<string|int, mixed>|null $where = null ]) : int
Parameters
$after : Carbon|null = null
$before : Carbon|null = null
$where : array<string|int, mixed>|null = null
Return values
int

getUserContractMorphTypeColumns()

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

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

makeParentAvatar()

public makeParentAvatar(User $context, int $id[, User|null $owner = null ][, string|null $imageCrop = null ]) : array<string, mixed>|null
Parameters
$context : User
$id : int
$owner : User|null = null
$imageCrop : string|null = null
Tags
inheritDoc
throws
AuthorizationException
Return values
array<string, mixed>|null

makeParentCover()

public makeParentCover(User $context, int $id) : bool
Parameters
$context : User
$id : int
Return values
bool

makeProfileAvatar()

public makeProfileAvatar(User $context, int $id[, string|null $imageCrop = null ]) : array<string, mixed>|null
Parameters
$context : User
$id : int
$imageCrop : string|null = null
Tags
inheritDoc
Return values
array<string, mixed>|null

makeProfileCover()

public makeProfileCover(User $context, int $id[, array<string, mixed> $attributes = [] ]) : bool
Parameters
$context : User
$id : int
$attributes : array<string, mixed> = []
Tags
throws
AuthorizationException
throws
ValidationException
Return values
bool

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

sponsor()

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

sponsorInFeed()

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

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>

unsponsor()

public unsponsor(User $context, int $id) : bool
Parameters
$context : User
$id : int
Return values
bool

unsponsorInFeed()

public unsponsorInFeed(User $context, int $id) : bool
Parameters
$context : User
$id : int
Return values
bool

updateAvatarPath()

public updateAvatarPath(int $photoId, string $path[, array<string|int, mixed> $sizes = [] ][, array<string|int, mixed> $squareSizes = [] ]) : string
Parameters
$photoId : int
$path : string
$sizes : array<string|int, mixed> = []
$squareSizes : array<string|int, mixed> = []
Return values
string

updatePhoto()

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

uploadMedias()

public uploadMedias(User $context, User $owner, array<string, mixed> $attributes) : PhotoGroup
Parameters
$context : User
$owner : User
$attributes : array<string, mixed>
Tags
throws
AuthorizationException
Return values
PhotoGroup

viewPhotos()

public viewPhotos(User $context, User $owner[, array<string|int, mixed> $attributes = [] ]) : Paginator
Parameters
$context : User
$owner : User
$attributes : array<string|int, mixed> = []
Return values
Paginator

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

getPrivacyForDefaultAlbum()

protected getPrivacyForDefaultAlbum(int $albumId, Photo $photo, array<string|int, mixed> $attributes) : array<string|int, mixed>
Parameters
$albumId : int
$photo : Photo
$attributes : array<string|int, mixed>
Return values
array<string|int, mixed>

getPrivacyForNormalAlbum()

protected getPrivacyForNormalAlbum(Album $album, array<string|int, mixed> $attributes) : array<string|int, mixed>
Parameters
$album : Album
$attributes : array<string|int, mixed>
Return values
array<string|int, mixed>

getPrivacyForRemovingAlbum()

protected getPrivacyForRemovingAlbum(Photo|null $photo, array<string|int, mixed> $attributes) : array<string|int, mixed>
Parameters
$photo : Photo|null
$attributes : array<string|int, mixed>
Return values
array<string|int, mixed>

handleBase64()

protected handleBase64(Photo $photo, string $base64) : void
Parameters
$photo : Photo
$base64 : 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>

handleMultipleTagFriends()

protected handleMultipleTagFriends(Photo $photo, array<string|int, mixed> $tags) : void
Parameters
$photo : Photo
$tags : array<string|int, mixed>

handleTaggedFriends()

protected handleTaggedFriends(User $user, Photo $photo, array<string|int, mixed> $keptTaggedFriends) : bool
Parameters
$user : User
$photo : Photo
$keptTaggedFriends : array<string|int, mixed>
Return values
bool

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>

prepareDataForGroupUpdate()

protected prepareDataForGroupUpdate(PhotoGroup|null $photoGroup, Photo $photo, array<string|int, mixed> &$attributes, array<string|int, mixed>|null &$groupAttributes) : void
Parameters
$photoGroup : PhotoGroup|null
$photo : Photo
$attributes : array<string|int, mixed>
$groupAttributes : array<string|int, mixed>|null

setContent()

protected setContent(array<string|int, mixed> &$attributes) : void
Parameters
$attributes : array<string|int, mixed>

unsetContent()

protected unsetContent(array<string|int, mixed> &$attributes) : mixed
Parameters
$attributes : array<string|int, mixed>

updateGlobalSearch()

protected updateGlobalSearch(Photo $photo, string|null $text) : bool|null
Parameters
$photo : Photo
$text : string|null
Return values
bool|null

uploadProfileCover()

protected uploadProfileCover(Photo $photo) : UploadedFile|null
Parameters
$photo : Photo
Return values
UploadedFile|null

uploadRawFile()

protected uploadRawFile(User $context, UploadedFile $file, array<string, mixed> $params) : StorageFile
Parameters
$context : User
$file : UploadedFile
$params : array<string, mixed>
Return values
StorageFile

applyDisplayPhotoSetting()

private applyDisplayPhotoSetting(Builder $query, User $owner, string $view) : Builder
Parameters
$query : Builder
$owner : User
$view : string
Tags
throws
AuthenticationException
SuppressWarnings

(PHPMD.CyclomaticComplexity)

SuppressWarnings

(PHPMD.NPathComplexity)

Return values
Builder

buildQueryPhotos()

private buildQueryPhotos(User $context, User $owner, array<string, mixed> $attributes) : Builder
Parameters
$context : User
$owner : User
$attributes : array<string, mixed>
Tags
throws
AuthorizationException
SuppressWarnings

(PHPMD.CyclomaticComplexity)

SuppressWarnings

(PHPMD.NPathComplexity)

Return values
Builder

checkPhotoQuota()

private checkPhotoQuota(User $context, mixed $files) : void
Parameters
$context : User
$files : mixed

checkUserUploadAvatarOrCover()

private checkUserUploadAvatarOrCover(string|null $type) : bool
Parameters
$type : string|null
Return values
bool

        
On this page

Search results