MetaFox

UserRepository extends AbstractRepository
in package
implements UserRepositoryInterface Uses HasFeatured, CollectTotalItemStatTrait, HasValidateUserTrait

Class UserRepositoryRepository.

Tags
SuppressWarnings

(PHPMD.CouplingBetweenObjects)

SuppressWarnings

(PHPMD.ExcessiveClassComplexity)

SuppressWarnings

(PHPMD.CyclomaticComplexity)

SuppressWarnings

(PHPMD.NPathComplexity)

SuppressWarnings

(PHPMD.ExcessiveClassLength)

SuppressWarnings

(PHPMD.TooManyMethods)

SuppressWarnings

(PHPMD.ExcessiveMethodLength)

Table of Contents

Interfaces

UserRepositoryInterface
Interface User.

Properties

$model  : User
$disableSponsor  : mixed
$skipPresenter  : mixed

Methods

approve()  : Content
assignRole()  : User
Add role/roles to an user.
banUser()  : bool
Ban an user.
boot()  : void
Boot up the repository, pushing criteria.
buildQueryScopes()  : mixed
cancelAccount()  : bool
cleanContent()  : string|null
cleanTitle()  : string|null
cleanUpDeletedUser()  : void
cleanUpExpiredBanData()  : bool
Clean all expired ban data.
create()  : User
createAvatar()  : void
createAvatarFromSignup()  : void
createMany()  : bool
createUser()  : User|null
deleteUser()  : bool
denyUser()  : Content
feature()  : bool
find()  : User
findAndValidateForAuth()  : User|null
Find an user for authentication.
findUserByEmail()  : User|null
Find an user by email.
findUserByEmailOrPhoneNumber()  : User|null
Find an user by email or phone.
getAdminAndStaffOptions()  : array<int, mixed>
getBan()  : UserBan|null
Get ban data of an user.
getChangeableProfileFields()  : array<string|int, mixed>
getInvisibleSettings()  : array<string, mixed>
getItemExtraStatistics()  : array<string, mixed>
getModel()  : User
getOnlineUserCount()  : int
getOnlineUserCount.
getPendingUserCount()  : int
getPendingUserCount.
getSuperAdmin()  : User|null
getTotalItemByPeriod()  : int
getTotalPendingItemByPeriod()  : int
getUserByRoleId()  : User
getUserContractMorphTypeColumns()  : array<string|int, string>
getUsersByRoleId()  : Collection|null
getVerifyBy()  : string|null
getVerifyMessage()  : string|null
hasSponsorView()  : bool
isBanned()  : bool
Check is banned.
isFeature()  : bool
isNoSponsorView()  : bool
likeOperator()  : string
return the case-insensitive LIKE operator bases on the current database driver.
model()  : string
Specify Model class name.
presenter()  : string
Include presenter.
pushProfileFeed()  : void
removeBanUser()  : bool
Remove user from ban.
removeCover()  : bool
removeRole()  : User
Remove an user role.
searchBlockUser()  : mixed
update()  : User
updateAvatar()  : array<string, mixed>
updateCover()  : array<string, mixed>
updateThemePreference()  : void
Update user profile config which being stored in User value table.
updateUser()  : User
updateVideosSettings()  : User
uploadAvatar()  : array<string, mixed>
validateStatuses()  : void
validateVerifiedBy()  : void
viewUser()  : User
View a user.
viewUsers()  : Paginator
Browse users.
where()  : $this
withUserMorphTypeActiveScope()  : self
buildQueryViewUsers()  : Builder
createPhoto()  : Collection|null
getMessageTextForOldMobileVersion()  : string
getProfileFeedAction()  : FeedAction|null
getUsersByLocation()  : Collection
handleProfileFeed()  : void
handleRelationshipFeed()  : void
handleVerify()  : array<string|int, mixed>
isOldMobileVersion()  : bool
isProfileChanged()  : bool
isRelationshipChanged()  : bool
isRelationshipChanged.
mustVerifyEmail()  : bool
mustVerifyPhoneNumber()  : bool
getBannedParams()  : array<string|int, mixed>
transformBannedReason()  : string|null
validateApproved()  : void
validateBanned()  : void
validateEmailAddress()  : mixed
validatePhoneNumber()  : void
validateVerified()  : mixed

Properties

Methods

assignRole()

Add role/roles to an user.

public assignRole(int $userId, mixed $roles) : User
Parameters
$userId : int
$roles : mixed
Return values
User

banUser()

Ban an user.

public banUser(User $user, User $owner[, mixed $day = 0 ][, mixed $returnUserGroup = UserRole::NORMAL_USER_ID ][, mixed $reason = null ]) : bool
Parameters
$user : User
$owner : User
$day : mixed = 0
$returnUserGroup : mixed = UserRole::NORMAL_USER_ID
$reason : mixed = null
Return values
bool

boot()

Boot up the repository, pushing criteria.

public boot() : void
Tags
throws
RepositoryException

buildQueryScopes()

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

cancelAccount()

public cancelAccount(User $context, int $id, array<string, mixed> $params) : bool
Parameters
$context : User
$id : int
$params : array<string, mixed>
Tags
throws
AuthorizationException
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

cleanUpDeletedUser()

public cleanUpDeletedUser([int $period = 1 ]) : void
Parameters
$period : int = 1

Users are deleted after this period of days shall be applicable

cleanUpExpiredBanData()

Clean all expired ban data.

public cleanUpExpiredBanData() : bool
Return values
bool

create()

public create(array<string, mixed> $params) : User
Parameters
$params : array<string, mixed>
Tags
throws
Exception
Return values
User

createAvatar()

public createAvatar(User $context, UploadedFile $image, array<string|int, mixed> $params) : void
Parameters
$context : User
$image : UploadedFile
$params : array<string|int, mixed>

createAvatarFromSignup()

public createAvatarFromSignup(User $context, UploadedFile $image, array<string, mixed> $params) : void
Parameters
$context : User
$image : UploadedFile
$params : array<string, mixed>
Tags
throws
AuthorizationException
throws
ValidationException

createMany()

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

createUser()

public createUser(array<string|int, mixed> $attributes) : User|null
Parameters
$attributes : array<string|int, mixed>
Tags
inheritDoc
throws
Exception
Return values
User|null

deleteUser()

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

denyUser()

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

feature()

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

find()

public find(mixed $id, mixed $columns) : User
Parameters
$id : mixed
$columns : mixed
Return values
User

findAndValidateForAuth()

Find an user for authentication.

public findAndValidateForAuth(string $username, string $password) : User|null
Parameters
$username : string
$password : string
Return values
User|null

findUserByEmail()

Find an user by email.

public findUserByEmail(string $email) : User|null
Parameters
$email : string
Return values
User|null

findUserByEmailOrPhoneNumber()

Find an user by email or phone.

public findUserByEmailOrPhoneNumber(string $value) : User|null
Parameters
$value : string
Return values
User|null

getAdminAndStaffOptions()

public getAdminAndStaffOptions() : array<int, mixed>
Return values
array<int, mixed>

getChangeableProfileFields()

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

getInvisibleSettings()

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

getItemExtraStatistics()

public getItemExtraStatistics(User $context, User $user, string $itemType, int $itemId) : array<string, mixed>
Parameters
$context : User
$user : User
$itemType : string
$itemId : int
Tags
inheritDoc
Return values
array<string, mixed>

getOnlineUserCount()

getOnlineUserCount.

public getOnlineUserCount() : int
Return values
int

getPendingUserCount()

getPendingUserCount.

public getPendingUserCount() : int
Return values
int

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

getUserByRoleId()

public getUserByRoleId(int $roleId) : User
Parameters
$roleId : int
Return values
User

getUserContractMorphTypeColumns()

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

getUsersByRoleId()

public getUsersByRoleId(int $roleId) : Collection|null
Parameters
$roleId : int
Tags
inheritDoc
Return values
Collection|null

getVerifyBy()

public getVerifyBy(User $user, string $value) : string|null
Parameters
$user : User
$value : string
Return values
string|null

getVerifyMessage()

public getVerifyMessage(string|null $email, string|null $phoneNumber, array<string|int, mixed> $params) : string|null
Parameters
$email : string|null
$phoneNumber : string|null
$params : array<string|int, mixed>
Return values
string|null

hasSponsorView()

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

isBanned()

Check is banned.

public isBanned(int $userId) : bool
Parameters
$userId : int
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

model()

Specify Model class name.

public model() : string
Return values
string

presenter()

Include presenter.

public presenter() : string
Return values
string

removeBanUser()

Remove user from ban.

public removeBanUser(User $user, User $owner) : bool
Parameters
$user : User
$owner : User
Return values
bool

removeCover()

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

removeRole()

Remove an user role.

public removeRole(int $userId, mixed $role) : User
Parameters
$userId : int
$role : mixed
Return values
User

searchBlockUser()

public searchBlockUser(User $user, string $search) : mixed
Parameters
$user : User
$search : string

update()

public update(array<string, mixed> $attributes, int $id) : User
Parameters
$attributes : array<string, mixed>
$id : int
Tags
throws
ValidatorException
Return values
User

updateAvatar()

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

updateCover()

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

updateThemePreference()

Update user profile config which being stored in User value table.

public updateThemePreference(User $user[, array<string|int, mixed> $attributes = [] ]) : void
Parameters
$user : User
$attributes : array<string|int, mixed> = []
Tags
inheritDoc

updateUser()

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

updateVideosSettings()

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

uploadAvatar()

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

validateVerifiedBy()

public validateVerifiedBy(User $user, string $verifyBy) : void
Parameters
$user : User
$verifyBy : string

viewUsers()

Browse users.

public viewUsers(User $context, array<string|int, mixed> $attributes) : Paginator
Parameters
$context : 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

buildQueryViewUsers()

protected buildQueryViewUsers(User $context, array<string, mixed> $attributes) : Builder
Parameters
$context : User
$attributes : array<string, mixed>
Tags
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
Builder

createPhoto()

protected createPhoto(User $context, User $owner, array<string, mixed> $params, int $albumType[, string|null $typeId = null ]) : Collection|null
Parameters
$context : User
$owner : User
$params : array<string, mixed>
$albumType : int
$typeId : string|null = null
Return values
Collection|null

getMessageTextForOldMobileVersion()

protected getMessageTextForOldMobileVersion(string|null $reason, int $time) : string
Parameters
$reason : string|null
$time : int
Tags
deprecated

Need remove for some next version

Return values
string

getUsersByLocation()

protected getUsersByLocation(User $context) : Collection
Parameters
$context : User
Return values
Collection

handleProfileFeed()

protected handleProfileFeed(User $user, array<string|int, mixed> $attributes) : void
Parameters
$user : User
$attributes : array<string|int, mixed>

handleRelationshipFeed()

protected handleRelationshipFeed(User $context, array<string|int, mixed> $attributes) : void
Parameters
$context : User
$attributes : array<string|int, mixed>

handleVerify()

protected handleVerify(User $user, array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$user : User
$params : array<string|int, mixed>
Return values
array<string|int, mixed>

isOldMobileVersion()

protected isOldMobileVersion() : bool
Tags
deprecated

Need remove for some next version

Return values
bool

isProfileChanged()

protected isProfileChanged(array<string|int, mixed> $newProfile, array<string|int, mixed> $oldProfile) : bool
Parameters
$newProfile : array<string|int, mixed>
$oldProfile : array<string|int, mixed>
Return values
bool

isRelationshipChanged()

isRelationshipChanged.

protected isRelationshipChanged(array<string|int, mixed> $newProfile, array<string|int, mixed> $oldProfile) : bool
Parameters
$newProfile : array<string|int, mixed>
$oldProfile : array<string|int, mixed>
Return values
bool

mustVerifyEmail()

protected mustVerifyEmail(string|null $email, array<string|int, mixed> $params) : bool
Parameters
$email : string|null
$params : array<string|int, mixed>
Return values
bool

mustVerifyPhoneNumber()

protected mustVerifyPhoneNumber(string|null $phoneNumber, array<string|int, mixed> $params) : bool
Parameters
$phoneNumber : string|null
$params : array<string|int, mixed>
Return values
bool

getBannedParams()

private getBannedParams(UserBan $userBanned) : array<string|int, mixed>
Parameters
$userBanned : UserBan
Return values
array<string|int, mixed>

transformBannedReason()

private transformBannedReason(string|null $reason) : string|null
Parameters
$reason : string|null
Return values
string|null

        
On this page

Search results