@param mixed           $value
@param string          $className
@param ReflectionClass $ref

@return array
17256
protected function serializeInternalClass($value, $className, ReflectionClass $ref)
    {
        $paramsToSerialize = $this->getObjectProperties($ref, $value);
        $data = [self::CLASS_IDENTIFIER_KEY => $className];
        $data += \array_map([$this, 'serializeData'], $this->extractObjectData($value, $ref, $paramsToSerialize));

        return $data;
    }
919164
public function ref($spec, $value)
    {
        array_push($this->data, $value);
        /*
        * set content
        */
        $value = $this->cache->getContents($spec, [$value]);
        $this->content = array_merge($this->content, $value);
    }
1190078
protected function serializeObject($value)
    {
        if (self::$objectStorage->contains($value)) {
            return [self::CLASS_IDENTIFIER_KEY => '@'.self::$objectStorage[$value]];
        }

        self::$objectStorage->attach($value, self::$objectMappingIndex++);

        $reflection = new ReflectionClass($value);
        $className = $reflection->getName();

        return $this->serializeInternalClass($value, $className, $reflection);
    }
972680
private function getParameterValue(\ReflectionParameter $parameter, $value)
    {
        $class = $parameter->getClass();

        if ($class) {
            $className = $class->getName();

            if ($parameter->isVariadic()) {
                $result = [];

                foreach ($value as $subValue) {
                    $result[] = $this->getObject($className, $subValue);
                }

                return $result;
            }

            return $this->getObject($className, $value);
        }

        return $value;
    }
1243977
public function getClassTagsValues($className)
    {
        if (!isset($this->reflectedClassNames[$className])) {
            $this->reflectClass($className);
        }
        if (!isset($this->classTagsValues[$className])) {
            return [];
        }
        return isset($this->classTagsValues[$className]) ? $this->classTagsValues[$className] : [];
    }
482783
protected function unserializeObject($value)
    {
        $className = $value[static::CLASS_IDENTIFIER_KEY];
        unset($value[static::CLASS_IDENTIFIER_KEY]);

        if ($className[0] === '@') {
            $index = substr($className, 1);
            return $this->objectMapping[$index];
        }

        if (array_key_exists($className, $this->customObjectSerializerMap)) {
            $obj = $this->customObjectSerializerMap[$className]->unserialize($value);
            $this->objectMapping[$this->objectMappingIndex++] = $obj;
            return $obj;
        }

        if (!class_exists($className)) {
            throw new JsonSerializerException('Unable to find class ' . $className);
        }

        if ($className === 'DateTime') {
            $obj = $this->restoreUsingUnserialize($className, $value);
            $this->objectMapping[$this->objectMappingIndex++] = $obj;
            return $obj;
        }

        if (!$this->isSplList($className)) {
            $ref = new ReflectionClass($className);
            $obj = $ref->newInstanceWithoutConstructor();
        } else {
            $obj = new $className();
        }

        if ($obj instanceof \SplDoublyLinkedList) {
            $obj->unserialize($value['value']);
            $this->objectMapping[$this->objectMappingIndex++] = $obj;
            return $obj;
        }

        $this->objectMapping[$this->objectMappingIndex++] = $obj;
        foreach ($value as $property => $propertyValue) {
            try {
                $propRef = $ref->getProperty($property);
                $propRef->setAccessible(true);
                $propRef->setValue($obj, $this->unserializeData($propertyValue));
            } catch (ReflectionException $e) {
                switch ($this->undefinedAttributeMode) {
                    case static::UNDECLARED_PROPERTY_MODE_SET:
                        $obj->$property = $this->unserializeData($propertyValue);
                        break;
                    case static::UNDECLARED_PROPERTY_MODE_IGNORE:
                        break;
                    case static::UNDECLARED_PROPERTY_MODE_EXCEPTION:
                        throw new JsonSerializerException('Undefined attribute detected during unserialization');
                        break;
                }
            }
        }
        if (method_exists($obj, '__wakeup')) {
            $obj->__wakeup();
        }
        return $obj;
    }
834282
private function findProperty(\ReflectionClass $ref, $field)
    {
        while (!$ref->hasProperty($field)) {
            $ref = $ref->getParentClass();
        }

        return $ref->getProperty($field);
    }
431767
public static function unserialize(Serializer $serializer, $className, array $value)
    {
        $data = $serializer->unserialize($value[Serializer::SCALAR_VALUE]);

        /* @var SplFixedArray $instance */
        $ref = new ReflectionClass($className);
        $instance = $ref->newInstanceWithoutConstructor();

        $instance->setSize(count($data));
        foreach ($data as $k => $v) {
            $instance[$k] = $v;
        }

        return $instance;
    }
708105
protected function instance(&$value)
    {
        foreach ($this->instances as &$tuple) {
            if ($tuple[0] === $value) {
                if (
                    is_array($value) &&
                    !$this->isArrayReference($tuple[0], $value)
                ) {
                    continue;
                }

                return $tuple[1];
            }
        }

        return null;
    }
1032842
public function getClassPropertyNames($className)
    {
        if (!isset($this->reflectedClassNames[$className])) {
            $this->reflectClass($className);
        }
        return isset($this->classPropertyNames[$className]) ? $this->classPropertyNames[$className] : [];
    }
332751
private function getPossibleValues(string $className): array
    {
        $metadata = $this->entityManager->getClassMetadata($className);
        $standard = array_values($metadata->fieldNames);
        $custom = $this->getCustomSortingNames($className);

        return array_merge($standard, $custom);
    }
892561
public function parseProps(\ReflectionClass $ref)
    {
        foreach($ref->getProperties() as $prop)
        {
            $this->parseProp($ref, $prop);
        }
    }
504832
private function getObject(string $className, $value)
    {
        $packedObject = new PackedObject($className, $value);

        try {
            $object = $this->objectPacker->unpack($packedObject);
        }
        catch (ObjectNotConvertibleException $e) {
            throw new HttpBadRequestException($e->getMessage(), $e);
        }
        catch (ObjectNotFoundException $e) {
            throw new HttpNotFoundException($e->getMessage(), $e);
        }

        if ($object === null) {
            throw new HttpInternalServerErrorException('No object packer available for ' . $className);
        }

        return $object;
    }
518758
public static function factory($value)
    {
        
        if ($value instanceof self) {
            $value = $value->getValue();
        }
        
        $value = static::filter($value);
        
        if (!is_scalar($value)) {
            throw new ErrorException("A value object must be created from a scalar value!");
        }
        
        $classname = get_called_class();
        
        if (!isset(self::$instances[$classname])) {
            self::$instances[$classname] = array();
        }
    
        // lazy load the value-object
        if (!isset(self::$instances[$classname][$value])) {
            if (func_num_args()>1) {
                // construct value-object with more then the pure scalar value
                // (not really correct in terms of value-objects, but sometimes needed)
                $arguments = func_get_args();
                $reflection = new \ReflectionClass($classname);
                self::$instances[$classname][$value] = $reflection->newInstanceArgs($arguments);
                
            } else {
                self::$instances[$classname][$value] = new static($value);
            }
        }
    
        return self::$instances[$classname][$value];
    }
1100025
private function getValues($value)
    {
        if (is_array($value)) {
            $newValue = [];

            foreach ($value as $itemValue) {
                $newValue = array_merge($newValue, $this->getValues($itemValue));
            }

            return [$newValue];
        }

        $metadataFactory = $this->em->getMetadataFactory();
        $unitOfWork      = $this->em->getUnitOfWork();

        if (is_object($value) && $metadataFactory->hasMetadataFor(StaticClassNameConverter::getClass($value))) {
            $class     = $metadataFactory->getMetadataFor(get_class($value));
            $persister = $unitOfWork->getEntityPersister($class->getClassName());

            if ($class->isIdentifierComposite()) {
                $newValue = [];

                foreach ($persister->getIdentifier($value) as $innerValue) {
                    $newValue = array_merge($newValue, $this->getValues($innerValue));
                }

                return $newValue;
            }
        }

        return [$this->getIndividualValue($value)];
    }
1129126
public function parse($value, $providers = [], $references = [])
    {
        $referenceName = substr($value, 1);

        if (isset($references[$referenceName])) {
            return $references[$referenceName];
        }

        return $value;
    }
1016758
public function buildDiscriminatorValueMap($className)
    {
        $rClass = new ReflectionClass($className);

        /** @var DiscriminatorEntry|null $annotation */
        $annotation = $this->getReader()->getClassAnnotation($rClass, DiscriminatorEntry::class);

        if (null === $annotation) {
            return false;
        }

        return $annotation->value;
    }