PHP Class Owl\Services\UserService

Inheritance: extends Service
Show file Open project: owl/owl Class Usage Examples

Protected Properties

Property Type Description
$loginTokenRepo Owl\Repositories\LoginTokenRepositoryInterface
$mailNotifyRepo Owl\Repositories\UserMailNotificationRepositoryInterface
$userRepo Owl\Repositories\UserRepositoryInterface

Public Methods

Method Description
__construct ( Owl\Repositories\UserRepositoryInterface $userRepo, Owl\Repositories\LoginTokenRepositoryInterface $loginTokenRepo, Owl\Repositories\UserMailNotificationRepositoryInterface $mailNotifyRepo )
create ( array $credentials = [] ) : stdclass Create a new user.
getAll ( ) : array
getByEmail ( string $email ) : stdclass Get a user by email.
getById ( integer $id ) : stdclass Get a user by user id.
getByToken ( string $token ) : stdclass Get a user by login token.
getByUsername ( string $username ) : stdclass Get a user by username.
getCurrentUser ( ) : stdclass
getLikeUsername ( string $username ) : stdclass Get users by username like search.
getOwners ( ) : array
getUser ( array $wkey ) : stdClass Get a user by specified keys.
getUsersToArray ( $users ) : array get users array
isOwner ( ) : boolean
update ( integer $id, string $username, string $email, $role ) : stdclass Update a user information(username, email).
updateToken ( integer $userId, string $token ) : boolean Update the "remember me" token by user ID.

Method Details

__construct() public method

public __construct ( Owl\Repositories\UserRepositoryInterface $userRepo, Owl\Repositories\LoginTokenRepositoryInterface $loginTokenRepo, Owl\Repositories\UserMailNotificationRepositoryInterface $mailNotifyRepo )
$userRepo Owl\Repositories\UserRepositoryInterface
$loginTokenRepo Owl\Repositories\LoginTokenRepositoryInterface
$mailNotifyRepo Owl\Repositories\UserMailNotificationRepositoryInterface

create() public method

Create a new user.
public create ( array $credentials = [] ) : stdclass
$credentials array (email, username, password)
return stdclass

getAll() public method

public getAll ( ) : array
return array

getByEmail() public method

Get a user by email.
public getByEmail ( string $email ) : stdclass
$email string
return stdclass

getById() public method

Get a user by user id.
public getById ( integer $id ) : stdclass
$id integer
return stdclass

getByToken() public method

Get a user by login token.
public getByToken ( string $token ) : stdclass
$token string
return stdclass | bool

getByUsername() public method

Get a user by username.
public getByUsername ( string $username ) : stdclass
$username string
return stdclass

getCurrentUser() public method

public getCurrentUser ( ) : stdclass
return stdclass | bool

getLikeUsername() public method

Get users by username like search.
public getLikeUsername ( string $username ) : stdclass
$username string
return stdclass

getOwners() public method

public getOwners ( ) : array
return array

getUser() public method

Get a user by specified keys.
public getUser ( array $wkey ) : stdClass
$wkey array
return stdClass | null

getUsersToArray() public method

get users array
public getUsersToArray ( $users ) : array
return array

isOwner() public method

public isOwner ( ) : boolean
return boolean

update() public method

Update a user information(username, email).
public update ( integer $id, string $username, string $email, $role ) : stdclass
$id integer
$username string
$email string
return stdclass

updateToken() public method

Update the "remember me" token by user ID.
public updateToken ( integer $userId, string $token ) : boolean
$userId integer
$token string
return boolean

Property Details

$loginTokenRepo protected property

protected LoginTokenRepositoryInterface,Owl\Repositories $loginTokenRepo
return Owl\Repositories\LoginTokenRepositoryInterface

$mailNotifyRepo protected property

protected UserMailNotificationRepositoryInterface,Owl\Repositories $mailNotifyRepo
return Owl\Repositories\UserMailNotificationRepositoryInterface

$userRepo protected property

protected UserRepositoryInterface,Owl\Repositories $userRepo
return Owl\Repositories\UserRepositoryInterface