Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
isTrait example
$attributes
=
[
]
;
foreach
(
$class
->
getAttributes
(
)
as
$a
)
{
$attributes
[
]
=
[
$a
->
getName
(
)
,
(string)
$a
]
;
}
yield
print_r
(
$attributes
, true
)
;
$attributes
=
[
]
;
yield
$class
->
getDocComment
(
)
;
yield
(int)
$class
->
isFinal
(
)
;
yield
(int)
$class
->
isAbstract
(
)
;
if
(
$class
->
isTrait
(
)
)
{
yield
print_r
(
class_uses
(
$class
->name
)
, true
)
;
}
else
{
yield
print_r
(
class_parents
(
$class
->name
)
, true
)
;
yield
print_r
(
class_implements
(
$class
->name
)
, true
)
;
yield
print_r
(
$class
->
getConstants
(
)
, true
)
;
}
if
(
!
$class
->
isInterface
(
)
)
{
$defaults
=
$class
->
getDefaultProperties
(
)
;
foreach
(
$class
->
getProperties
(
\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED
)
as
$p
)
{
$parts
=
explode
(
'\\',
$class
)
;
if
(
$parts
[
0
]
!== 'Shopware'
)
{
continue
;
}
$reflector
=
new
\
ReflectionClass
(
$class
)
;
if
(
!
$reflector
->
isSubclassOf
(
Struct::
class
)
)
{
continue
;
}
if
(
$reflector
->
isAbstract
(
)
||
$reflector
->
isInterface
(
)
||
$reflector
->
isTrait
(
)
)
{
continue
;
}
if
(
$reflector
->
isSubclassOf
(
AggregationResult::
class
)
)
{
continue
;
}
$instance
=
$reflector
->
newInstanceWithoutConstructor
(
)
;
if
(
$instance
instanceof Entity
)
{
continue
;
}