Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[VarDumper] add caster for MongoCursor objects
- Loading branch information
1 parent
1a4d7d7
commit 1008e6c
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?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 Symfony\Component\VarDumper\Cloner\Stub; | ||
|
||
/** | ||
* Casts classes from the MongoDb extension to array representation. | ||
* | ||
* @author Nicolas Grekas <p@tchwork.com> | ||
*/ | ||
class MongoCaster | ||
{ | ||
public static function castCursor(\MongoCursorInterface $cursor, array $a, Stub $stub, $isNested) | ||
{ | ||
$prefix = "\0~\0"; | ||
|
||
if ($info = $cursor->info()) { | ||
foreach ($info as $k => $v) { | ||
$a[$prefix.$k] = $v; | ||
} | ||
} | ||
$a[$prefix.'dead'] = $cursor->dead(); | ||
|
||
return $a; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters