Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getFileContent example
if
(
method_exists
(
$reflection
, 'getUseStatements'
)
)
{
return
$reflection
->
getUseStatements
(
)
;
}
$filename
=
$reflection
->
getFileName
(
)
;
if
(
$filename
=== false
)
{
return
[
]
;
}
$content
=
$this
->
getFileContent
(
$filename
,
$reflection
->
getStartLine
(
)
)
;
if
(
$content
=== null
)
{
return
[
]
;
}
$namespace
=
preg_quote
(
$reflection
->
getNamespaceName
(
)
)
;
$content
=
preg_replace
(
'/^.*?(\bnamespace\s+' .
$namespace
. '\s*[;{].*)$/s', '\\1',
$content
)
;
$tokenizer
=
new
TokenParser
(
'<?php ' .
$content
)
;
return
$tokenizer
->
parseUseStatements
(
$reflection
->
getNamespaceName
(
)
)
;
}