[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/symfony/var-dumper/Dumper/ -> ContextualizedDumper.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of the Symfony package.
   5   *
   6   * (c) Fabien Potencier <[email protected]>
   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\Dumper;
  13  
  14  use Symfony\Component\VarDumper\Cloner\Data;
  15  use Symfony\Component\VarDumper\Dumper\ContextProvider\ContextProviderInterface;
  16  
  17  /**
  18   * @author Kévin Thérage <[email protected]>
  19   */
  20  class ContextualizedDumper implements DataDumperInterface
  21  {
  22      private $wrappedDumper;
  23      private $contextProviders;
  24  
  25      /**
  26       * @param ContextProviderInterface[] $contextProviders
  27       */
  28      public function __construct(DataDumperInterface $wrappedDumper, array $contextProviders)
  29      {
  30          $this->wrappedDumper = $wrappedDumper;
  31          $this->contextProviders = $contextProviders;
  32      }
  33  
  34      public function dump(Data $data)
  35      {
  36          $context = [];
  37          foreach ($this->contextProviders as $contextProvider) {
  38              $context[\get_class($contextProvider)] = $contextProvider->getContext();
  39          }
  40  
  41          $this->wrappedDumper->dump($data->withContext($context));
  42      }
  43  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer