Linux unitednationsplay.com 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
nginx/1.20.1
Server IP : 188.130.139.92 & Your IP : 18.188.161.182
Domains :
Cant Read [ /etc/named.conf ]
User : web
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
home /
www /
wb /
vendor /
jms /
serializer /
src /
Handler /
Delete
Unzip
Name
Size
Permission
Date
Action
ArrayCollectionHandler.php
5.02
KB
-rw-rw-r--
2022-08-24 15:26
ConstraintViolationHandler.php
2.78
KB
-rw-rw-r--
2022-08-24 15:26
DateHandler.php
9.47
KB
-rw-rw-r--
2022-08-24 15:26
FormErrorHandler.php
5.34
KB
-rw-rw-r--
2022-08-24 15:26
HandlerRegistry.php
2.8
KB
-rw-rw-r--
2022-08-24 15:26
HandlerRegistryInterface.php
873
B
-rw-rw-r--
2022-08-24 15:26
IteratorHandler.php
3.57
KB
-rw-rw-r--
2022-08-24 15:26
LazyHandlerRegistry.php
2.1
KB
-rw-rw-r--
2022-08-24 15:26
StdClassHandler.php
1.52
KB
-rw-rw-r--
2022-08-24 15:26
SubscribingHandlerInterface.php
700
B
-rw-rw-r--
2022-08-24 15:26
SymfonyUidHandler.php
5.01
KB
-rw-rw-r--
2022-08-24 15:26
Save
Rename
<?php declare(strict_types=1); namespace JMS\Serializer\Handler; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ODM\MongoDB\PersistentCollection as MongoPersistentCollection; use Doctrine\ODM\PHPCR\PersistentCollection as PhpcrPersistentCollection; use Doctrine\ORM\PersistentCollection as OrmPersistentCollection; use Doctrine\Persistence\ManagerRegistry; use JMS\Serializer\DeserializationContext; use JMS\Serializer\GraphNavigatorInterface; use JMS\Serializer\Metadata\PropertyMetadata; use JMS\Serializer\SerializationContext; use JMS\Serializer\Visitor\DeserializationVisitorInterface; use JMS\Serializer\Visitor\SerializationVisitorInterface; final class ArrayCollectionHandler implements SubscribingHandlerInterface { public const COLLECTION_TYPES = [ 'ArrayCollection', ArrayCollection::class, OrmPersistentCollection::class, MongoPersistentCollection::class, PhpcrPersistentCollection::class, ]; /** * @var bool */ private $initializeExcluded; /** * @var ManagerRegistry|null */ private $managerRegistry; public function __construct( bool $initializeExcluded = true, ?ManagerRegistry $managerRegistry = null ) { $this->initializeExcluded = $initializeExcluded; $this->managerRegistry = $managerRegistry; } /** * {@inheritdoc} */ public static function getSubscribingMethods() { $methods = []; $formats = ['json', 'xml', 'yml']; foreach (self::COLLECTION_TYPES as $type) { foreach ($formats as $format) { $methods[] = [ 'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION, 'type' => $type, 'format' => $format, 'method' => 'serializeCollection', ]; $methods[] = [ 'direction' => GraphNavigatorInterface::DIRECTION_DESERIALIZATION, 'type' => $type, 'format' => $format, 'method' => 'deserializeCollection', ]; } } return $methods; } /** * @return array|\ArrayObject */ public function serializeCollection(SerializationVisitorInterface $visitor, Collection $collection, array $type, SerializationContext $context) { // We change the base type, and pass through possible parameters. $type['name'] = 'array'; $context->stopVisiting($collection); if (false === $this->initializeExcluded) { $exclusionStrategy = $context->getExclusionStrategy(); if (null !== $exclusionStrategy && $exclusionStrategy->shouldSkipClass($context->getMetadataFactory()->getMetadataForClass(\get_class($collection)), $context)) { $context->startVisiting($collection); return $visitor->visitArray([], $type); } } $result = $visitor->visitArray($collection->toArray(), $type); $context->startVisiting($collection); return $result; } /** * @param mixed $data */ public function deserializeCollection( DeserializationVisitorInterface $visitor, $data, array $type, DeserializationContext $context ): Collection { // See above. $type['name'] = 'array'; $elements = new ArrayCollection($visitor->visitArray($data, $type)); if (null === $this->managerRegistry) { return $elements; } $propertyMetadata = $context->getMetadataStack()->top(); if (!$propertyMetadata instanceof PropertyMetadata) { return $elements; } $objectManager = $this->managerRegistry->getManagerForClass($propertyMetadata->class); if (null === $objectManager) { return $elements; } $classMetadata = $objectManager->getClassMetadata($propertyMetadata->class); $currentObject = $visitor->getCurrentObject(); if ( array_key_exists('name', $propertyMetadata->type) && in_array($propertyMetadata->type['name'], self::COLLECTION_TYPES) && $classMetadata->isCollectionValuedAssociation($propertyMetadata->name) ) { $existingCollection = $classMetadata->getFieldValue($currentObject, $propertyMetadata->name); if (!$existingCollection instanceof OrmPersistentCollection) { return $elements; } foreach ($elements as $element) { if (!$existingCollection->contains($element)) { $existingCollection->add($element); } } foreach ($existingCollection as $collectionElement) { if (!$elements->contains($collectionElement)) { $existingCollection->removeElement($collectionElement); } } return $existingCollection; } return $elements; } }