Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getWords example
return
[
]
;
}
/** * {@inheritdoc} */
public
function
completeArgumentValues
(
$argumentName
, CompletionContext
$context
)
{
if
(
$argumentName
=== 'technical-name'
)
{
if
(
!\
is_null
(
$token
=
$this
->
getAuthenticationFromArguments
(
$context
->
getWords
(
)
)
)
)
{
$context
=
new
LicenceRequest
(
'en_GB',
$this
->
getVersionFromArguments
(
$context
->
getWords
(
)
)
,
$this
->
getDomainFromArguments
(
$context
->
getWords
(
)
)
,
$token
)
;
/** @var PluginStoreService $pluginStoreService */
$pluginStoreService
=
$this
->container->
get
(
PluginStoreService::
class
)
;
return
array_map
(
function
DLicenceStruct
$licence
)
{
return
$licence
->
getTechnicalName
(
)
;
}
,
$pluginStoreService
->
getLicences
(
$context
)
)
;
}
}
if
(
is_numeric
(
$context
->
getCurrentWord
(
)
)
)
{
$queryBuilder
->
andWhere
(
$queryBuilder
->
expr
(
)
->
like
(
'shop.id', ':id'
)
)
->
setParameter
(
'id',
addcslashes
(
$context
->
getCurrentWord
(
)
, '%_'
)
. '%'
)
;
}
$result
=
$queryBuilder
->
select
(
[
'shop.id'
]
)
->
addOrderBy
(
$queryBuilder
->
expr
(
)
->
asc
(
'shop.id'
)
)
->
getQuery
(
)
->
getArrayResult
(
)
;
$alreadyTakenShopIds
=
array_filter
(
$context
->
getWords
(
)
, 'is_numeric'
)
;
return
array_diff
(
array_column
(
$result
, 'id'
)
,
$alreadyTakenShopIds
)
;
}
return
[
]
;
}
/** * {@inheritdoc} */
protected
function
configure
(
)
{
if
(
$optionName
=== 'namespace'
)
{
$namespaces
=
[
'core',
'frontend',
'backend',
'ShopwarePlugins',
'ProjectPlugins',
]
;
return
array_diff
(
$namespaces
,
array_intersect
(
$namespaces
,
$context
->
getWords
(
)
)
)
;
}
return
[
]
;
}
/** * {@inheritdoc} */
public
function
completeArgumentValues
(
$argumentName
, CompletionContext
$context
)
: array
{
return
[
]
;
}
class
ThemeCacheGenerateCommand
extends
ShopwareCommand
implements
CompletionAwareInterface
{
/** * {@inheritdoc} */
public
function
completeOptionValues
(
$optionName
, CompletionContext
$context
)
{
if
(
$optionName
=== 'shopId'
)
{
$shopIdKeys
=
array_map
(
static
function
D
$key
)
{
return
$key
+ 1;
}
,
array_keys
(
$context
->
getWords
(
)
, '--shopId'
)
)
;
$combinedArray
=
array_combine
(
$shopIdKeys
,
array_pad
(
[
]
, \
count
(
$shopIdKeys
)
, 0
)
)
;
if
(
!\
is_array
(
$combinedArray
)
)
{
throw
new
RuntimeException
(
'Arrays could not be combined'
)
;
}
$selectedShopIds
=
array_intersect_key
(
$context
->
getWords
(
)
,
$combinedArray
)
;
return
array_diff
(
$this
->
completeShopIds
(
$context
->
getCurrentWord
(
)
)
,
array_map
(
'\intval',
$selectedShopIds
)
)
;
}
return
[
]
;
}