CoreFiles by mySites.guru
ServerDumper.php53 lines, 1,578 bytes, from Joomla_6.0.0-beta2-Beta-Full_Package.zip
Raw History Compare with 6.0.0-beta1
md5
f4f94b72e6271c1ca8f50855e395b757
sha1
fa1ab58ebe0e34a45f8670e115ab809c87d17ffb
sha256
ea421008577eb9babbf138150c928b1c5d01aa324d34fa7cf5fd05c4e47d219a
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\VarDumper\Dumper;

use Symfony\Component\VarDumper\Cloner\Data;
use Symfony\Component\VarDumper\Dumper\ContextProvider\ContextProviderInterface;
use Symfony\Component\VarDumper\Server\Connection;

/**
 * ServerDumper forwards serialized Data clones to a server.
 *
 * @author Maxime Steinhausser <[email protected]>
 */
class ServerDumper implements DataDumperInterface
{
    private Connection $connection;

    /**
     * @param string                     $host             The server host
     * @param DataDumperInterface|null   $wrappedDumper    A wrapped instance used whenever we failed contacting the server
     * @param ContextProviderInterface[] $contextProviders Context providers indexed by context name
     */
    public function __construct(
        string $host,
        private ?DataDumperInterface $wrappedDumper = null,
        array $contextProviders = [],
    ) {
        $this->connection = new Connection($host, $contextProviders);
    }

    public function getContextProviders(): array
    {
        return $this->connection->getContextProviders();
    }

    public function dump(Data $data): ?string
    {
        if (!$this->connection->write($data) && $this->wrappedDumper) {
            return $this->wrappedDumper->dump($data);
        }

        return null;
    }
}

The same content is in 49 releases, Joomla 6.0.0-beta1 to 6.3.0-alpha1. See them all, or every version of this file.