<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace Slash\Booking\Vendor\Symfony\Component\VarDumper\Cloner;

use Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\Caster;
use Slash\Booking\Vendor\Symfony\Component\VarDumper\Exception\ThrowingCasterException;
/**
 * AbstractCloner implements a generic caster mechanism for objects and resources.
 *
 * @author Nicolas Grekas <p@tchwork.com>
 */
abstract class AbstractCloner implements ClonerInterface
{
    public static array $defaultCasters = ['__PHP_Incomplete_Class' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\Caster', 'castPhpIncompleteClass'], 'AddressInfo' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\AddressInfoCaster', 'castAddressInfo'], 'Socket' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\SocketCaster', 'castSocket'], 'Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\CutStub' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\StubCaster', 'castStub'], 'Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\CutArrayStub' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\StubCaster', 'castCutArray'], 'Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ConstStub' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\StubCaster', 'castStub'], 'Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\EnumStub' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\StubCaster', 'castEnum'], 'Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ScalarStub' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\StubCaster', 'castScalar'], 'Fiber' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\FiberCaster', 'castFiber'], 'Closure' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castClosure'], 'Generator' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castGenerator'], 'ReflectionType' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castType'], 'ReflectionAttribute' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castAttribute'], 'ReflectionGenerator' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castReflectionGenerator'], 'ReflectionClass' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castClass'], 'ReflectionClassConstant' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castClassConstant'], 'ReflectionFunctionAbstract' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castFunctionAbstract'], 'ReflectionMethod' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castMethod'], 'ReflectionParameter' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castParameter'], 'ReflectionProperty' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castProperty'], 'ReflectionReference' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castReference'], 'ReflectionExtension' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castExtension'], 'ReflectionZendExtension' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castZendExtension'], 'Slash\Booking\Vendor\Doctrine\Common\Persistence\ObjectManager' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], 'Slash\Booking\Vendor\Doctrine\Common\Proxy\Proxy' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castCommonProxy'], 'Slash\Booking\Vendor\Doctrine\ORM\Proxy\Proxy' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castOrmProxy'], 'Slash\Booking\Vendor\Doctrine\ORM\PersistentCollection' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castPersistentCollection'], 'Slash\Booking\Vendor\Doctrine\Persistence\ObjectManager' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], 'DOMException' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DOMCaster', 'castException'], 'Slash\Booking\Vendor\Dom\Exception' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DOMCaster', 'castException'], 'DOMStringList' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], 'DOMNameList' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], 'DOMImplementation' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DOMCaster', 'castImplementation'], 'Slash\Booking\Vendor\Dom\Implementation' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DOMCaster', 'castImplementation'], 'DOMImplementationList' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], 'DOMNode' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], 'Slash\Booking\Vendor\Dom\Node' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], 'DOMNameSpaceNode' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], 'DOMDocument' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DOMCaster', 'castDocument'], 'Slash\Booking\Vendor\Dom\XMLDocument' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DOMCaster', 'castXMLDocument'], 'Slash\Booking\Vendor\Dom\HTMLDocument' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DOMCaster', 'castHTMLDocument'], 'DOMNodeList' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], 'Slash\Booking\Vendor\Dom\NodeList' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], 'DOMNamedNodeMap' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], 'Slash\Booking\Vendor\Dom\DTDNamedNodeMap' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], 'DOMXPath' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], 'Slash\Booking\Vendor\Dom\XPath' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], 'Slash\Booking\Vendor\Dom\HTMLCollection' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], 'Slash\Booking\Vendor\Dom\TokenList' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], 'XMLReader' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\XmlReaderCaster', 'castXmlReader'], 'ErrorException' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castErrorException'], 'Exception' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castException'], 'Error' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castError'], 'Slash\Booking\Vendor\Symfony\Bridge\Monolog\Logger' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], 'Slash\Booking\Vendor\Symfony\Component\DependencyInjection\ContainerInterface' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], 'Slash\Booking\Vendor\Symfony\Component\EventDispatcher\EventDispatcherInterface' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], 'Slash\Booking\Vendor\Symfony\Component\HttpClient\AmpHttpClient' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClient'], 'Slash\Booking\Vendor\Symfony\Component\HttpClient\CurlHttpClient' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClient'], 'Slash\Booking\Vendor\Symfony\Component\HttpClient\NativeHttpClient' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClient'], 'Slash\Booking\Vendor\Symfony\Component\HttpClient\Response\AmpResponse' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClientResponse'], 'Slash\Booking\Vendor\Symfony\Component\HttpClient\Response\AmpResponseV4' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClientResponse'], 'Slash\Booking\Vendor\Symfony\Component\HttpClient\Response\AmpResponseV5' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClientResponse'], 'Slash\Booking\Vendor\Symfony\Component\HttpClient\Response\CurlResponse' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClientResponse'], 'Slash\Booking\Vendor\Symfony\Component\HttpClient\Response\NativeResponse' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClientResponse'], 'Slash\Booking\Vendor\Symfony\Component\HttpFoundation\Request' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castRequest'], 'Slash\Booking\Vendor\Symfony\Component\Uid\Ulid' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castUlid'], 'Slash\Booking\Vendor\Symfony\Component\Uid\Uuid' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castUuid'], 'Slash\Booking\Vendor\Symfony\Component\VarExporter\Internal\LazyObjectState' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castLazyObjectState'], 'Slash\Booking\Vendor\Symfony\Component\VarDumper\Exception\ThrowingCasterException' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castThrowingCasterException'], 'Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\TraceStub' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castTraceStub'], 'Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\FrameStub' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castFrameStub'], 'Slash\Booking\Vendor\Symfony\Component\VarDumper\Cloner\AbstractCloner' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], 'Slash\Booking\Vendor\Symfony\Component\ErrorHandler\Exception\FlattenException' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castFlattenException'], 'Slash\Booking\Vendor\Symfony\Component\ErrorHandler\Exception\SilencedErrorContext' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castSilencedErrorContext'], 'Slash\Booking\Vendor\Imagine\Image\ImageInterface' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ImagineCaster', 'castImage'], 'Slash\Booking\Vendor\Ramsey\Uuid\UuidInterface' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\UuidCaster', 'castRamseyUuid'], 'Slash\Booking\Vendor\ProxyManager\Proxy\ProxyInterface' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ProxyManagerCaster', 'castProxy'], 'PHPUnit_Framework_MockObject_MockObject' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], 'PHPUnit\Framework\MockObject\MockObject' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], 'PHPUnit\Framework\MockObject\Stub' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], 'Slash\Booking\Vendor\Prophecy\Prophecy\ProphecySubjectInterface' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], 'Slash\Booking\Vendor\Mockery\MockInterface' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], 'PDO' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\PdoCaster', 'castPdo'], 'PDOStatement' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\PdoCaster', 'castPdoStatement'], 'AMQPConnection' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\AmqpCaster', 'castConnection'], 'AMQPChannel' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\AmqpCaster', 'castChannel'], 'AMQPQueue' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\AmqpCaster', 'castQueue'], 'AMQPExchange' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\AmqpCaster', 'castExchange'], 'AMQPEnvelope' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\AmqpCaster', 'castEnvelope'], 'ArrayObject' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\SplCaster', 'castArrayObject'], 'ArrayIterator' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\SplCaster', 'castArrayIterator'], 'SplDoublyLinkedList' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\SplCaster', 'castDoublyLinkedList'], 'SplFileInfo' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\SplCaster', 'castFileInfo'], 'SplFileObject' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\SplCaster', 'castFileObject'], 'SplHeap' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\SplCaster', 'castHeap'], 'SplObjectStorage' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\SplCaster', 'castObjectStorage'], 'SplPriorityQueue' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\SplCaster', 'castHeap'], 'OuterIterator' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\SplCaster', 'castOuterIterator'], 'WeakMap' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\SplCaster', 'castWeakMap'], 'WeakReference' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\SplCaster', 'castWeakReference'], 'Redis' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedis'], 'Slash\Booking\Vendor\Relay\Relay' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedis'], 'RedisArray' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedisArray'], 'RedisCluster' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedisCluster'], 'DateTimeInterface' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DateCaster', 'castDateTime'], 'DateInterval' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DateCaster', 'castInterval'], 'DateTimeZone' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DateCaster', 'castTimeZone'], 'DatePeriod' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DateCaster', 'castPeriod'], 'GMP' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\GmpCaster', 'castGmp'], 'MessageFormatter' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\IntlCaster', 'castMessageFormatter'], 'NumberFormatter' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\IntlCaster', 'castNumberFormatter'], 'IntlTimeZone' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\IntlCaster', 'castIntlTimeZone'], 'IntlCalendar' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\IntlCaster', 'castIntlCalendar'], 'IntlDateFormatter' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\IntlCaster', 'castIntlDateFormatter'], 'Memcached' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\MemcachedCaster', 'castMemcached'], 'Slash\Booking\Vendor\Ds\Collection' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DsCaster', 'castCollection'], 'Slash\Booking\Vendor\Ds\Map' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DsCaster', 'castMap'], 'Slash\Booking\Vendor\Ds\Pair' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DsCaster', 'castPair'], 'Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DsPairStub' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\DsCaster', 'castPairStub'], 'mysqli_driver' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\MysqliCaster', 'castMysqliDriver'], 'CurlHandle' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\CurlCaster', 'castCurl'], 'Slash\Booking\Vendor\Dba\Connection' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'], ':dba' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'], ':dba persistent' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'], 'GdImage' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\GdCaster', 'castGd'], 'SQLite3Result' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\SqliteCaster', 'castSqlite3Result'], 'Slash\Booking\Vendor\PgSql\Lob' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLargeObject'], 'Slash\Booking\Vendor\PgSql\Connection' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLink'], 'Slash\Booking\Vendor\PgSql\Result' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castResult'], ':process' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ResourceCaster', 'castProcess'], ':stream' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStream'], 'OpenSSLAsymmetricKey' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\OpenSSLCaster', 'castOpensslAsymmetricKey'], 'OpenSSLCertificateSigningRequest' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\OpenSSLCaster', 'castOpensslCsr'], 'OpenSSLCertificate' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\OpenSSLCaster', 'castOpensslX509'], ':persistent stream' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStream'], ':stream-context' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStreamContext'], 'XmlParser' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\XmlResourceCaster', 'castXml'], 'RdKafka' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castRdKafka'], 'Slash\Booking\Vendor\RdKafka\Conf' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castConf'], 'Slash\Booking\Vendor\RdKafka\KafkaConsumer' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castKafkaConsumer'], 'Slash\Booking\Vendor\RdKafka\Metadata\Broker' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castBrokerMetadata'], 'Slash\Booking\Vendor\RdKafka\Metadata\Collection' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castCollectionMetadata'], 'Slash\Booking\Vendor\RdKafka\Metadata\Partition' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castPartitionMetadata'], 'Slash\Booking\Vendor\RdKafka\Metadata\Topic' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castTopicMetadata'], 'Slash\Booking\Vendor\RdKafka\Message' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castMessage'], 'Slash\Booking\Vendor\RdKafka\Topic' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castTopic'], 'Slash\Booking\Vendor\RdKafka\TopicPartition' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castTopicPartition'], 'Slash\Booking\Vendor\RdKafka\TopicConf' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castTopicConf'], 'Slash\Booking\Vendor\FFI\CData' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\FFICaster', 'castCTypeOrCData'], 'Slash\Booking\Vendor\FFI\CType' => ['Slash\Booking\Vendor\Symfony\Component\VarDumper\Caster\FFICaster', 'castCTypeOrCData']];
    protected int $maxItems = 2500;
    protected int $maxString = -1;
    protected int $minDepth = 1;
    /**
     * @var array<string, list<callable>>
     */
    private array $casters = [];
    /**
     * @var callable|null
     */
    private $prevErrorHandler;
    private array $classInfo = [];
    private int $filter = 0;
    /**
     * @param callable[]|null $casters A map of casters
     *
     * @see addCasters
     */
    public function __construct(?array $casters = null)
    {
        $this->addCasters($casters ?? static::$defaultCasters);
    }
    /**
     * Adds casters for resources and objects.
     *
     * Maps resources or object types to a callback.
     * Use types as keys and callable casters as values.
     * Prefix types with `::`,
     * see e.g. self::$defaultCasters.
     *
     * @param array<string, callable> $casters A map of casters
     */
    public function addCasters(array $casters): void
    {
        foreach ($casters as $type => $callback) {
            $this->casters[$type][] = $callback;
        }
    }
    /**
     * Adds default casters for resources and objects.
     *
     * Maps resources or object types to a callback.
     * Use types as keys and callable casters as values.
     * Prefix types with `::`,
     * see e.g. self::$defaultCasters.
     *
     * @param array<string, callable> $casters A map of casters
     */
    public static function addDefaultCasters(array $casters): void
    {
        self::$defaultCasters = [...self::$defaultCasters, ...$casters];
    }
    /**
     * Sets the maximum number of items to clone past the minimum depth in nested structures.
     */
    public function setMaxItems(int $maxItems): void
    {
        $this->maxItems = $maxItems;
    }
    /**
     * Sets the maximum cloned length for strings.
     */
    public function setMaxString(int $maxString): void
    {
        $this->maxString = $maxString;
    }
    /**
     * Sets the minimum tree depth where we are guaranteed to clone all the items.  After this
     * depth is reached, only setMaxItems items will be cloned.
     */
    public function setMinDepth(int $minDepth): void
    {
        $this->minDepth = $minDepth;
    }
    /**
     * Clones a PHP variable.
     *
     * @param int $filter A bit field of Caster::EXCLUDE_* constants
     */
    public function cloneVar(mixed $var, int $filter = 0): Data
    {
        $this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) {
            if (\E_RECOVERABLE_ERROR === $type || \E_USER_ERROR === $type) {
                // Cloner never dies
                throw new \ErrorException($msg, 0, $type, $file, $line);
            }
            if ($this->prevErrorHandler) {
                return ($this->prevErrorHandler)($type, $msg, $file, $line, $context);
            }
            return \false;
        });
        $this->filter = $filter;
        if ($gc = gc_enabled()) {
            gc_disable();
        }
        try {
            return new Data($this->doClone($var));
        } finally {
            if ($gc) {
                gc_enable();
            }
            restore_error_handler();
            $this->prevErrorHandler = null;
        }
    }
    /**
     * Effectively clones the PHP variable.
     */
    abstract protected function doClone(mixed $var): array;
    /**
     * Casts an object to an array representation.
     *
     * @param bool $isNested True if the object is nested in the dumped structure
     */
    protected function castObject(Stub $stub, bool $isNested): array
    {
        $obj = $stub->value;
        $class = $stub->class;
        if (str_contains($class, "@anonymous\x00")) {
            $stub->class = get_debug_type($obj);
        }
        if (isset($this->classInfo[$class])) {
            [$i, $parents, $hasDebugInfo, $fileInfo] = $this->classInfo[$class];
        } else {
            $i = 2;
            $parents = [$class];
            $hasDebugInfo = method_exists($class, '__debugInfo');
            foreach (class_parents($class) as $p) {
                $parents[] = $p;
                ++$i;
            }
            foreach (class_implements($class) as $p) {
                $parents[] = $p;
                ++$i;
            }
            $parents[] = '*';
            $r = new \ReflectionClass($class);
            $fileInfo = $r->isInternal() || $r->isSubclassOf(Stub::class) ? [] : ['file' => $r->getFileName(), 'line' => $r->getStartLine()];
            $this->classInfo[$class] = [$i, $parents, $hasDebugInfo, $fileInfo];
        }
        $stub->attr += $fileInfo;
        $a = Caster::castObject($obj, $class, $hasDebugInfo, $stub->class);
        try {
            while ($i--) {
                if (!empty($this->casters[$p = $parents[$i]])) {
                    foreach ($this->casters[$p] as $callback) {
                        $a = $callback($obj, $a, $stub, $isNested, $this->filter);
                    }
                }
            }
        } catch (\Exception $e) {
            $a = [(Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '') . '⚠' => new ThrowingCasterException($e)] + $a;
        }
        return $a;
    }
    /**
     * Casts a resource to an array representation.
     *
     * @param bool $isNested True if the object is nested in the dumped structure
     */
    protected function castResource(Stub $stub, bool $isNested): array
    {
        $a = [];
        $res = $stub->value;
        $type = $stub->class;
        try {
            if (!empty($this->casters[':' . $type])) {
                foreach ($this->casters[':' . $type] as $callback) {
                    $a = $callback($res, $a, $stub, $isNested, $this->filter);
                }
            }
        } catch (\Exception $e) {
            $a = [(Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '') . '⚠' => new ThrowingCasterException($e)] + $a;
        }
        return $a;
    }
}
