Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
preloadType example
$r
=
new
\
ReflectionClass
(
$class
)
;
if
(
$r
->
isInternal
(
)
)
{
return
;
}
$r
->
getConstants
(
)
;
$r
->
getDefaultProperties
(
)
;
foreach
(
$r
->
getProperties
(
\ReflectionProperty::IS_PUBLIC
)
as
$p
)
{
self::
preloadType
(
$p
->
getType
(
)
,
$preloaded
)
;
}
foreach
(
$r
->
getMethods
(
\ReflectionMethod::IS_PUBLIC
)
as
$m
)
{
foreach
(
$m
->
getParameters
(
)
as
$p
)
{
if
(
$p
->
isDefaultValueAvailable
(
)
&&
$p
->
isDefaultValueConstant
(
)
)
{
$c
=
$p
->
getDefaultValueConstantName
(
)
;
if
(
$i
=
strpos
(
$c
, '::'
)
)
{
self::
doPreload
(
substr
(
$c
, 0,
$i
)
,
$preloaded
)
;
}
}
$r
=
new
\
ReflectionClass
(
$class
)
;
if
(
$r
->
isInternal
(
)
)
{
return
;
}
$r
->
getConstants
(
)
;
$r
->
getDefaultProperties
(
)
;
foreach
(
$r
->
getProperties
(
\ReflectionProperty::IS_PUBLIC
)
as
$p
)
{
self::
preloadType
(
$p
->
getType
(
)
,
$preloaded
)
;
}
foreach
(
$r
->
getMethods
(
\ReflectionMethod::IS_PUBLIC
)
as
$m
)
{
foreach
(
$m
->
getParameters
(
)
as
$p
)
{
if
(
$p
->
isDefaultValueAvailable
(
)
&&
$p
->
isDefaultValueConstant
(
)
)
{
$c
=
$p
->
getDefaultValueConstantName
(
)
;
if
(
$i
=
strpos
(
$c
, '::'
)
)
{
self::
doPreload
(
substr
(
$c
, 0,
$i
)
,
$preloaded
)
;
}
}