class TagHandler

Class TagHandler

Properties

protected TagRepository $repo TagRepository instance
protected Decomposer $decomposer Decomposer instance

Methods

__construct(TagRepository $repo, Decomposer $decomposer)

TagHandler constructor.

Collection|Tag[]
set(string $taggableId, array $words = array(), string|null $instanceId = null)

Set taggable's tags

Tag[]
multisort(array $std, Tag[] $tags)

Sort tags by given words

string
nonNumeric(string|int $v)

Convert to non numeric string

Collection|Tag[]
similar(string $string, int $take = 15, string|null $instanceId = null)

Search similar tags by given string

string[]
similarWord(string $string, int $take = 15, string|null $instanceId = null)

Search similar words by given string

getDecomposer()

Get the decomposer instance.

void
setDecomposer(Decomposer $decomposer)

Set the decomposer instance.

mixed
__call(string $name, array $arguments)

__call

Details

at line 53
__construct(TagRepository $repo, Decomposer $decomposer)

TagHandler constructor.

Parameters

TagRepository $repo TagRepository instance
Decomposer $decomposer Decomposer instance

at line 67
Collection|Tag[] set(string $taggableId, array $words = array(), string|null $instanceId = null)

Set taggable's tags

Parameters

string $taggableId taggable id
array $words tag word
string|null $instanceId instance id of taggable

Return Value

Collection|Tag[] model collection

at line 105
private Tag[] multisort(array $std, Tag[] $tags)

Sort tags by given words

Parameters

array $std standard array for sort
Tag[] $tags tags array

Return Value

Tag[]

at line 124
private string nonNumeric(string|int $v)

Convert to non numeric string

Parameters

string|int $v string

Return Value

string

at line 137
Collection|Tag[] similar(string $string, int $take = 15, string|null $instanceId = null)

Search similar tags by given string

Parameters

string $string partial of word
int $take take count
string|null $instanceId instance id of taggable

Return Value

Collection|Tag[]

at line 150
string[] similarWord(string $string, int $take = 15, string|null $instanceId = null)

Search similar words by given string

Parameters

string $string partial of word
int $take take count
string|null $instanceId instance id of taggable

Return Value

string[]

at line 162
Decomposer getDecomposer()

Get the decomposer instance.

Return Value

Decomposer

at line 173
void setDecomposer(Decomposer $decomposer)

Set the decomposer instance.

Parameters

Decomposer $decomposer decomposer instance

Return Value

void

at line 185
mixed __call(string $name, array $arguments)

__call

Parameters

string $name method name
array $arguments arguments

Return Value

mixed