class Counter

Counter

  • Factory 에 의해서 인스턴스 생성
  • $name, $options 멤버 변수를 이용해서 등록, 조회, 삭제할 때 counter_logs 테이블의 counterName, counterOption 컬럼에 사용
  • $name 에 따라 여러 유형의 Counter 인스턴스를 만들 수 있음
  • $options 는 $name 에서 사용할 option 항목

Properties

protected $model model class name
protected Request $request
protected string $name 카운터 이름
protected array $options 카운터에 사용할 선택 항목
protected bool $guest 비회원 지원

Methods

__construct(Request $request, string $name, array $options = array())

Counter constructor.

void
setGuest(bool $use = true)

비회원 지원 설정

string
getName()

get name

array
getOptions()

get options

void
checkOption(string $option)

check option

void
checkGuest(UserInterface $user = null)

check support guest

bool
hasByName(string $targetId, UserInterface $user = null)

has by name

bool
has(string $targetId, UserInterface $user = null, string $option = '')

has log

void
add(string $targetId, UserInterface $user = null, string $option = '', int $point = 1)

add log

void
remove(string $targetId, UserInterface $user = null, string $option = '')

remove log

CounterLog|null
get(string $targetId, UserInterface $user = null, string $option = '')

get log

CounterLog|null
getByName(string $targetId, UserInterface $user = null)

get log by name 옵션을 사용하는 Counter 에서 로그를 확인 할 때 등록된 옵션은 제외하고 확인하려고 할 수 있음

int
getPoint(string $targetId, string $option = '')

get point sum

void
putPoint(string $targetId, UserInterface $user = null, string $option = '', int $point = 1)

put log

array
getUsers(string $targetId, string $option = '')

get users

string
getModel()

The name of CounterLog model class

newModel()

Create model instance

Details

at line 82
__construct(Request $request, string $name, array $options = array())

Counter constructor.

Parameters

Request $request request
string $name counter name
array $options counter options

at line 95
void setGuest(bool $use = true)

비회원 지원 설정

Parameters

bool $use guest support flag

Return Value

void

at line 105
string getName()

get name

Return Value

string

at line 115
array getOptions()

get options

Return Value

array

at line 127
protected void checkOption(string $option)

check option

Parameters

string $option counter option

Return Value

void

Exceptions

InvalidOptionException

at line 143
protected void checkGuest(UserInterface $user = null)

check support guest

Parameters

UserInterface $user user

Return Value

void

Exceptions

GuestNotSupportException

at line 157
bool hasByName(string $targetId, UserInterface $user = null)

has by name

Parameters

string $targetId targetId
UserInterface $user user instance

Return Value

bool

at line 170
bool has(string $targetId, UserInterface $user = null, string $option = '')

has log

Parameters

string $targetId target id
UserInterface $user user instance
string $option counter option

Return Value

bool

at line 184
void add(string $targetId, UserInterface $user = null, string $option = '', int $point = 1)

add log

Parameters

string $targetId target id
UserInterface $user user instance
string $option counter option
int $point point

Return Value

void

at line 214
void remove(string $targetId, UserInterface $user = null, string $option = '')

remove log

Parameters

string $targetId target id
UserInterface $user user instance
string $option counter option

Return Value

void

at line 236
CounterLog|null get(string $targetId, UserInterface $user = null, string $option = '')

get log

Parameters

string $targetId target id
UserInterface $user user instance
string $option counter option

Return Value

CounterLog|null

at line 256
CounterLog|null getByName(string $targetId, UserInterface $user = null)

get log by name 옵션을 사용하는 Counter 에서 로그를 확인 할 때 등록된 옵션은 제외하고 확인하려고 할 수 있음

Parameters

string $targetId target id
UserInterface $user user instance

Return Value

CounterLog|null

at line 274
int getPoint(string $targetId, string $option = '')

get point sum

Parameters

string $targetId target id
string $option counter option

Return Value

int

at line 291
void putPoint(string $targetId, UserInterface $user = null, string $option = '', int $point = 1)

put log

Parameters

string $targetId target id
UserInterface $user user instance
string $option counter option
int $point point

Return Value

void

at line 320
array getUsers(string $targetId, string $option = '')

get users

Parameters

string $targetId target id
string $option counter option

Return Value

array

at line 339
string getModel()

The name of CounterLog model class

Return Value

string

at line 349
CounterLog newModel()

Create model instance

Return Value

CounterLog