PHP Class Xpressengine\Counter\Counter

* Factory 에 의해서 인스턴스 생성 * $name, $options 멤버 변수를 이용해서 등록, 조회, 삭제할 때 counter_logs 테이블의 counterName, counterOption 컬럼에 사용 * $name 에 따라 여러 유형의 Counter 인스턴스를 만들 수 있음 * $options 는 $name 에서 사용할 option 항목
Author: XE Developers ([email protected])
Mostra file Open project: xpressengine/xpressengine Class Usage Examples

Protected Properties

Property Type Description
$guest boolean 비회원 지원
$model model class name
$name string 카운터 이름
$options array 카운터에 사용할 선택 항목
$request Xpressengine\Http\Request

Public Methods

Method Description
__construct ( Request $request, string $name, array $options = [] ) Counter constructor.
add ( string $targetId, Xpressengine\User\UserInterface $user = null, string $option = '', integer $point = 1 ) : void add log
get ( string $targetId, Xpressengine\User\UserInterface $user = null, string $option = '' ) : CounterLog | null get log
getByName ( string $targetId, Xpressengine\User\UserInterface $user = null ) : CounterLog | null get log by name 옵션을 사용하는 Counter 에서 로그를 확인 할 때 등록된 옵션은 제외하고 확인하려고 할 수 있음
getModel ( ) : string The name of CounterLog model class
getName ( ) : string get name
getOptions ( ) : array get options
getPoint ( string $targetId, string $option = '' ) : integer get point sum
getUsers ( string $targetId, string $option = '' ) : array get users
has ( string $targetId, Xpressengine\User\UserInterface $user = null, string $option = '' ) : boolean has log
hasByName ( string $targetId, Xpressengine\User\UserInterface $user = null ) : boolean has by name
newModel ( ) : CounterLog Create model instance
putPoint ( string $targetId, Xpressengine\User\UserInterface $user = null, string $option = '', integer $point = 1 ) : void put log
remove ( string $targetId, Xpressengine\User\UserInterface $user = null, string $option = '' ) : void remove log
setGuest ( boolean $use = true ) : void 비회원 지원 설정

Protected Methods

Method Description
checkGuest ( Xpressengine\User\UserInterface $user = null ) : void check support guest
checkOption ( string $option ) : void check option

Method Details

__construct() public method

Counter constructor.
public __construct ( Request $request, string $name, array $options = [] )
$request Xpressengine\Http\Request request
$name string counter name
$options array counter options

add() public method

add log
public add ( string $targetId, Xpressengine\User\UserInterface $user = null, string $option = '', integer $point = 1 ) : void
$targetId string target id
$user Xpressengine\User\UserInterface user instance
$option string counter option
$point integer point
return void

checkGuest() protected method

check support guest
protected checkGuest ( Xpressengine\User\UserInterface $user = null ) : void
$user Xpressengine\User\UserInterface user
return void

checkOption() protected method

check option
protected checkOption ( string $option ) : void
$option string counter option
return void

get() public method

get log
public get ( string $targetId, Xpressengine\User\UserInterface $user = null, string $option = '' ) : CounterLog | null
$targetId string target id
$user Xpressengine\User\UserInterface user instance
$option string counter option
return Xpressengine\Counter\Models\CounterLog | null

getByName() public method

get log by name 옵션을 사용하는 Counter 에서 로그를 확인 할 때 등록된 옵션은 제외하고 확인하려고 할 수 있음
public getByName ( string $targetId, Xpressengine\User\UserInterface $user = null ) : CounterLog | null
$targetId string target id
$user Xpressengine\User\UserInterface user instance
return Xpressengine\Counter\Models\CounterLog | null

getModel() public method

The name of CounterLog model class
public getModel ( ) : string
return string

getName() public method

get name
public getName ( ) : string
return string

getOptions() public method

get options
public getOptions ( ) : array
return array

getPoint() public method

get point sum
public getPoint ( string $targetId, string $option = '' ) : integer
$targetId string target id
$option string counter option
return integer

getUsers() public method

get users
public getUsers ( string $targetId, string $option = '' ) : array
$targetId string target id
$option string counter option
return array

has() public method

has log
public has ( string $targetId, Xpressengine\User\UserInterface $user = null, string $option = '' ) : boolean
$targetId string target id
$user Xpressengine\User\UserInterface user instance
$option string counter option
return boolean

hasByName() public method

has by name
public hasByName ( string $targetId, Xpressengine\User\UserInterface $user = null ) : boolean
$targetId string targetId
$user Xpressengine\User\UserInterface user instance
return boolean

newModel() public method

Create model instance
public newModel ( ) : CounterLog
return Xpressengine\Counter\Models\CounterLog

putPoint() public method

put log
public putPoint ( string $targetId, Xpressengine\User\UserInterface $user = null, string $option = '', integer $point = 1 ) : void
$targetId string target id
$user Xpressengine\User\UserInterface user instance
$option string counter option
$point integer point
return void

remove() public method

remove log
public remove ( string $targetId, Xpressengine\User\UserInterface $user = null, string $option = '' ) : void
$targetId string target id
$user Xpressengine\User\UserInterface user instance
$option string counter option
return void

setGuest() public method

비회원 지원 설정
public setGuest ( boolean $use = true ) : void
$use boolean guest support flag
return void

Property Details

$guest protected_oe property

비회원 지원
protected bool $guest
return boolean

$model protected_oe property

model class name
protected $model

$name protected_oe property

카운터 이름
protected string $name
return string

$options protected_oe property

카운터에 사용할 선택 항목
protected array $options
return array

$request protected_oe property

protected Request,Xpressengine\Http $request
return Xpressengine\Http\Request