get_class
symfony/var-dumper
Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Returns the name of the class of an object
get_class
(
object $object
= ?):
string
switch (
\gettype
(
$value
)) {
case
'object'
:
$this
->
type
=
self
::
TYPE_OBJECT
;
$this
->
class
=
\get_class
(
$value
);
if (
$value
instanceof
\Closure
) {
ReflectionCaster
::
castClosure
(
$value
, [],
$this
,
true
,
Caster
::
EXCLUDE_VERBOSE
);
Caster/CutStub.php
if (!(
$flags
&
\ArrayObject
::
STD_PROP_LIST
)) {
$c
->
setFlags
(
\ArrayObject
::
STD_PROP_LIST
);
$a
=
Caster
::
castObject
(
$c
,
\get_class
(
$c
),
method_exists
(
$c
,
'__debugInfo'
),
$stub
->
class
);
$c
->
setFlags
(
$flags
);
}
if (
\PHP_VERSION_ID
<
70400
) {
Caster/SplCaster.php
public static function
castHttpClient
(
$client
, array
$a
,
Stub $stub
,
bool $isNested
)
{
$multiKey
=
sprintf
(
"\0%s\0multi"
,
\get_class
(
$client
));
if (isset(
$a
[
$multiKey
])) {
$a
[
$multiKey
] = new
CutStub
(
$a
[
$multiKey
]);
}
Caster/SymfonyCaster.php
if (empty(
$objRefs
[
$h
=
spl_object_id
(
$v
)])) {
$stub
= new
Stub
();
$stub
->
type
=
Stub
::
TYPE_OBJECT
;
$stub
->
class
=
\get_class
(
$v
);
$stub
->
value
=
$v
;
$stub
->
handle
=
$h
;
$a
=
$this
->
castObject
(
$stub
,
0
<
$i
);
Cloner/VarCloner.php
{
$context
= [];
foreach (
$this
->
contextProviders
as
$contextProvider
) {
$context
[
\get_class
(
$contextProvider
)] =
$contextProvider
->
getContext
();
}
$this
->
wrappedDumper
->
dump
(
$data
->
withContext
(
$context
));
Dumper/ContextualizedDumper.php
public function
__construct
(
\Throwable $prev
)
{
parent
::
__construct
(
'Unexpected '
.
\get_class
(
$prev
).
' thrown from a caster: '
.
$prev
->
getMessage
(),
0
,
$prev
);
}
}
Exception/ThrowingCasterException.php
public function
testAnonymous
()
{
$e
= new
\Exception
(
sprintf
(
'Boo "%s" ba.'
,
\get_class
(new class(
'Foo'
) extends
\Exception
{
})));
$expectedDump
= <<<'EODUMP'
Exception {
Tests/Caster/ExceptionCasterTest.php
public function
testClassStubWithAnonymousClass
()
{
$var
= [new
ClassStub
(
\get_class
(new class() extends
\Exception
{
}))];
$cloner
= new
VarCloner
();
$dumper
= new
HtmlDumper
();
Tests/Caster/StubCasterTest.php