Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
groupTokenKeywords example
if
(
empty
(
$tokens
)
)
{
return
new
SearchPattern
(
new
SearchTerm
(
''
)
)
;
}
$tokenSlops
=
$this
->
slop
(
$tokens
)
;
if
(
!
$this
->
checkSlops
(
array_values
(
$tokenSlops
)
)
)
{
return
new
SearchPattern
(
new
SearchTerm
(
$word
)
)
;
}
$tokenKeywords
=
$this
->
fetchKeywords
(
$context
,
$tokenSlops
)
;
$matches
=
array_fill
(
0, \
count
(
$tokens
)
,
[
]
)
;
$matches
=
$this
->
groupTokenKeywords
(
$matches
,
$tokenKeywords
)
;
$combines
=
$this
->
permute
(
$tokens
)
;
foreach
(
$combines
as
$token
)
{
$tokens
[
]
=
$token
;
}
/** @var list<string> $tokens */
$tokens
=
array_keys
(
array_flip
(
$tokens
)
)
;
$pattern
=
new
SearchPattern
(
new
SearchTerm
(
$word
)
)
;