4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\VarDumper\Caster;
14 use Symfony\Component\HttpFoundation\Request;
15 use Symfony\Component\VarDumper\Cloner\Stub;
19 private static $requestGetters = array(
20 'pathInfo' => 'getPathInfo',
21 'requestUri' => 'getRequestUri',
22 'baseUrl' => 'getBaseUrl',
23 'basePath' => 'getBasePath',
24 'method' => 'getMethod',
25 'format' => 'getRequestFormat',
28 public static function castRequest(Request $request, array $a, Stub $stub, $isNested)
32 foreach (self::$requestGetters as $prop => $getter) {
33 if (null === $a[Caster::PREFIX_PROTECTED.$prop]) {
34 if (null === $clone) {
35 $clone = clone $request;
37 $a[Caster::PREFIX_VIRTUAL.$prop] = $clone->{$getter}();