MongoCaster.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\VarDumper\Caster;
  11. use Symfony\Component\VarDumper\Cloner\Stub;
  12. @trigger_error('The '.__NAMESPACE__.'\MongoCaster class is deprecated since Symfony 3.4 and will be removed in 4.0.', E_USER_DEPRECATED);
  13. /**
  14. * Casts classes from the MongoDb extension to array representation.
  15. *
  16. * @author Nicolas Grekas <p@tchwork.com>
  17. *
  18. * @deprecated since version 3.4, to be removed in 4.0.
  19. */
  20. class MongoCaster
  21. {
  22. public static function castCursor(\MongoCursorInterface $cursor, array $a, Stub $stub, $isNested)
  23. {
  24. if ($info = $cursor->info()) {
  25. foreach ($info as $k => $v) {
  26. $a[Caster::PREFIX_VIRTUAL.$k] = $v;
  27. }
  28. }
  29. $a[Caster::PREFIX_VIRTUAL.'dead'] = $cursor->dead();
  30. return $a;
  31. }
  32. }