Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getFilesInDir example
private
function
createPluginConfig
(
string
$name
, string
$path
)
: StorefrontPluginConfiguration
{
$config
=
new
StorefrontPluginConfiguration
(
$name
)
;
$config
->
setIsTheme
(
false
)
;
$config
->
setStorefrontEntryFilepath
(
$this
->
getEntryFile
(
$path
)
)
;
$config
->
setBasePath
(
$this
->
stripProjectDir
(
$path
)
)
;
$stylesPath
=
$path
. \DIRECTORY_SEPARATOR . 'Resources/app/storefront/src/scss';
$config
->
setStyleFiles
(
FileCollection::
createFromArray
(
$this
->
getScssEntryFileInDir
(
$stylesPath
)
)
)
;
$scriptPath
=
$path
. \DIRECTORY_SEPARATOR . 'Resources/app/storefront/dist/storefront/js';
$config
->
setScriptFiles
(
FileCollection::
createFromArray
(
$this
->
getFilesInDir
(
$scriptPath
)
)
)
;
return
$config
;
}
private
function
createThemeConfig
(
string
$name
, string
$path
)
: StorefrontPluginConfiguration
{
$pathname
=
$path
. \DIRECTORY_SEPARATOR . 'Resources/theme.json';
if
(
!
file_exists
(
$pathname
)
)
{
throw
new
InvalidThemeBundleException
(
$name
)
;
}