Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / symfony / var-dumper / Caster / SymfonyCaster.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\VarDumper\Caster;
13
14 use Symfony\Component\HttpFoundation\Request;
15 use Symfony\Component\VarDumper\Cloner\Stub;
16
17 class SymfonyCaster
18 {
19     private static $requestGetters = array(
20         'pathInfo' => 'getPathInfo',
21         'requestUri' => 'getRequestUri',
22         'baseUrl' => 'getBaseUrl',
23         'basePath' => 'getBasePath',
24         'method' => 'getMethod',
25         'format' => 'getRequestFormat',
26     );
27
28     public static function castRequest(Request $request, array $a, Stub $stub, $isNested)
29     {
30         $clone = null;
31
32         foreach (self::$requestGetters as $prop => $getter) {
33             if (null === $a[Caster::PREFIX_PROTECTED.$prop]) {
34                 if (null === $clone) {
35                     $clone = clone $request;
36                 }
37                 $a[Caster::PREFIX_VIRTUAL.$prop] = $clone->{$getter}();
38             }
39         }
40
41         return $a;
42     }
43 }