Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getValidLocales example
if
(
!
file_exists
(
$snippetsDir
)
)
{
throw
new
RuntimeException
(
sprintf
(
'Could not find %s folder for snippet validation',
$snippetsDir
)
)
;
}
$dirIterator
=
new
RecursiveDirectoryIterator
(
$snippetsDir
, RecursiveDirectoryIterator::SKIP_DOTS
)
;
$iterator
=
new
RecursiveIteratorIterator
(
$dirIterator
,
RecursiveIteratorIterator::LEAVES_ONLY
)
;
$invalidSnippets
=
[
]
;
$validLocales
=
$this
->
getValidLocales
(
)
;
/** @var SplFileInfo $entry */
foreach
(
$iterator
as
$entry
)
{
if
(
!
$entry
->
isFile
(
)
||
substr
(
$entry
->
getFilename
(
)
, -4
)
!== '.ini'
)
{
continue
;
}
$data
= @
parse_ini_file
(
$entry
->
getRealPath
(
)
, true
)
;
if
(
$data
=== false
)
{
$error
=
error_get_last
(
)
;
/** * @return AdminUser */
protected
function
getAdminInfoFromArgs
(
InputInterface
$input
, AdminUser
$adminUser
)
{
$adminUser
->username =
$input
->
getOption
(
'admin-username'
)
;
$adminUser
->email =
$input
->
getOption
(
'admin-email'
)
;
$adminUser
->password =
$input
->
getOption
(
'admin-password'
)
;
$adminUser
->locale =
$input
->
getOption
(
'admin-locale'
)
;
$adminUser
->name =
$input
->
getOption
(
'admin-name'
)
;
if
(
$adminUser
->locale && !\
in_array
(
$adminUser
->locale, Locale::
getValidLocales
(
)
)
)
{
throw
new
RuntimeException
(
'Invalid admin-locale provided'
)
;
}
return
$adminUser
;
}
/** * @return AdminUser */
protected
function
getAdminInfoFromInteractiveShell
(
AdminUser
$adminUser
)
{