Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
extractProductionNamespaceParts example
$phpFiles
=
(
new
Finder
(
)
)
->
files
(
)
->
in
(
$basePath
)
->
exclude
(
'WebInstaller'
)
->
name
(
'*.php'
)
->
getIterator
(
)
;
$errors
=
[
]
;
foreach
(
$phpFiles
as
$file
)
{
if
(
$this
->
hasNamespaceDefined
(
$file
)
=== false
)
{
continue
;
}
$parts
=
$this
->
extractProductionNamespaceParts
(
$file
,
$basePathParts
)
;
$path
=
implode
(
'\\',
$parts
)
;
if
(
mb_strpos
(
$path
, 'Recovery'
)
=== 0
)
{
continue
;
}
$namespace
=
rtrim
(
'namespace Shopware\\' .
$path
, '\\'
)
;
if
(
mb_strpos
(
$file
->
getContents
(
)
,
$namespace
)
=== false
)
{
$relativePath
=
str_replace
(
$basePath
, '',
$file
->
getPathname
(
)
)
;
$errors
[
'src/' .
$relativePath
]
=
$namespace
;
}