Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
hasNamespaceDefined example
$basePath
= __DIR__ . '/../../../';
$basePathParts
=
explode
(
'/',
$basePath
)
;
$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
, '\\'
)
;