Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4095882
DsCaster.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
DsCaster.php
View Options
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace
Symfony\Component\VarDumper\Caster
;
use
Ds\Collection
;
use
Ds\Map
;
use
Ds\Pair
;
use
Symfony\Component\VarDumper\Cloner\Stub
;
/**
* Casts Ds extension classes to array representation.
*
* @author Jáchym Toušek <enumag@gmail.com>
*
* @final
*/
class
DsCaster
{
public
static
function
castCollection
(
Collection
$c
,
array
$a
,
Stub
$stub
,
bool
$isNested
):
array
{
$a
[
Caster
::
PREFIX_VIRTUAL
.
'count'
]
=
$c
->
count
();
$a
[
Caster
::
PREFIX_VIRTUAL
.
'capacity'
]
=
$c
->
capacity
();
if
(!
$c
instanceof
Map
)
{
$a
+=
$c
->
toArray
();
}
return
$a
;
}
public
static
function
castMap
(
Map
$c
,
array
$a
,
Stub
$stub
,
bool
$isNested
):
array
{
foreach
(
$c
as
$k
=>
$v
)
{
$a
[]
=
new
DsPairStub
(
$k
,
$v
);
}
return
$a
;
}
public
static
function
castPair
(
Pair
$c
,
array
$a
,
Stub
$stub
,
bool
$isNested
):
array
{
foreach
(
$c
->
toArray
()
as
$k
=>
$v
)
{
$a
[
Caster
::
PREFIX_VIRTUAL
.
$k
]
=
$v
;
}
return
$a
;
}
public
static
function
castPairStub
(
DsPairStub
$c
,
array
$a
,
Stub
$stub
,
bool
$isNested
):
array
{
if
(
$isNested
)
{
$stub
->
class
=
Pair
::
class
;
$stub
->
value
=
null
;
$stub
->
handle
=
0
;
$a
=
$c
->
value
;
}
return
$a
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Aug 18, 14:05 (4 w, 4 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
5f/5e/50a6c18c2e7bb0b55743decad7d2
Default Alt Text
DsCaster.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment