Get the value for serialization.

@param mixed $value

@return mixed
502223
public static function make($value)
    {
        if (is_resource($value)) {
            $value = null;
        } elseif (Arr::accessible($value)) {
            $value = new ArraySerialization($value);
        } elseif ($value instanceof stdClass) {
            $value = new ObjectSerialization($value);
        } elseif ($value instanceof Container) {
            $value = new ContainerSerialization($value);
        } elseif ($value instanceof DateTime) {
            $value = new DateTimeSerialization($value);
        } elseif ($value instanceof Validator) {
            $value = new ValidatorSerialization($value);
        } elseif ($value instanceof Throwable) {
            $value = new ThrowableSerialization($value);
        } elseif ($value instanceof Closure) {
            $value = null;
        }

        return $value;
    }
1020861
private static function serializeValue( $value ) {
		try {
			return serialize( $value );
		} catch ( \Exception $ex ) {
			self::$logger->error( 'Value serialization failed: ' . $ex->getMessage() );
			return null;
		}
	}
111840
protected function getProperty($value) {
        $prop = $this->reflectionClass->getProperty($value);
        $prop->setAccessible(true);
        return $prop;
    }
983659
public function serialize($value) {
        $filters = $this->getFilters();
        for ($i = count($filters) - 1; $i >= 0; --$i) {
            $value = $filters[$i]->fromValue($value);
        }
        return $this->toData($value);
    }
741575
public function unserializeData($value)
    {
        if (\is_array($value)) {
            return $value;
        }

        if (0 === strpos($value, 'a:')) {
            return \unserialize($value, ['allowed_classes' => false]);
        }

        return $value;
    }
478765
protected function serializeObject($value)
    {
        if ($this->objectStorage->contains($value)) {
            return array(static::CLASS_IDENTIFIER_KEY => '@' . $this->objectStorage[$value]);
        }
        $this->objectStorage->attach($value, $this->objectMappingIndex++);

        $ref = new ReflectionClass($value);
        $className = $ref->getName();
        if (array_key_exists($className, $this->customObjectSerializerMap)) {
            $data = array(static::CLASS_IDENTIFIER_KEY => $className);
            $data += $this->customObjectSerializerMap[$className]->serialize($value);
            return $data;
        }

        $paramsToSerialize = $this->getObjectProperties($ref, $value);
        $data = array(static::CLASS_IDENTIFIER_KEY => $className);

        if ($value instanceof \SplDoublyLinkedList) {
            return $data + array('value' => $value->serialize());
        }

        $data += array_map(array($this, 'serializeData'), $this->extractObjectData($value, $ref, $paramsToSerialize));
        return $data;
    }
680007
public function serialize($value)
    {
        $this->reset();

        return $this->serializationStrategy->serialize($this->serializeData($value));
    }
723443
protected function serializeObject($value)
    {
        if ($value instanceof Collection) {
            return $this->serializeEloquentCollection($value);
        }

        if ($value instanceof Paginator) {
            return $this->serializeEloquentPaginatedResource($value);
        }

        if (\is_subclass_of($value, Model::class, true)) {
            return $this->serializeEloquentModel($value);
        }

        return parent::serializeObject($value);
    }
1369779
public function serialize($value)
    {
        $this->noMappingGuard();

        if (\is_array($value) && !empty($value[Serializer::MAP_TYPE])) {
            $data = $this->serializedArray($value);
        } else {
            $data = $this->serializeObject($value);
        }

        return \json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
    }
189818
public function makeStorableArrayFieldValue($value)
    {
        if ($this->_isEncodedArrayFieldValue($value)) {
            $value = $this->_decodeArrayFieldValue($value);
        }

        $value = $this->_serializeValue($value);
        return $value;
    }
881112
public function serialize($value): string
    {
        $id = $this->entityManager->getClassMetadata($this->className)->getIdentifierValues($value);

        return (string) reset($id);
    }
1246921
protected function unserialize($value)
    {
        if (is_numeric($value)) {
            $int = (int) $value;
            if ((string) $int === $value) {
                return $int;
            }

            $float = (float) $value;
            if ((string) $float === $value) {
                return $float;
            }

            return $value;
        }

        return unserialize($value);
    }
805241
protected function serializeData($value)
    {
        if (is_scalar($value) || $value === null) {
            if (!$this->preserveZeroFractionSupport && is_float($value) && ctype_digit((string)$value)) {
                // Because the PHP bug #50224, the float numbers with no
                // precision numbers are converted to integers when encoded
                $value = static::FLOAT_ADAPTER . '(' . $value . '.0)';
            }
            return $value;
        }
        if (is_resource($value)) {
            throw new JsonSerializerException('Resource is not supported in JsonSerializer');
        }
        if (is_array($value)) {
            return array_map(array($this, __FUNCTION__), $value);
        }
        if ($value instanceof \Closure) {
            if (!$this->closureSerializer) {
                throw new JsonSerializerException('Closure serializer not given. Unable to serialize closure.');
            }
            return array(
                static::CLOSURE_IDENTIFIER_KEY => true,
                'value' => $this->closureSerializer->serialize($value)
            );
        }
        return $this->serializeObject($value);
    }
1095287
private function makeSerializable($value)
    {
        if (null === $value) {
            return $value;
        }

        if ($value instanceof Traversable || is_array($value)) {
            $value = ArrayUtils::iteratorToArray($value);

            foreach ($value as $key => $val) {
                $value[$key] = $this->makeSerializable($val);
            }

            return $value;
        }

        if (is_scalar($value)) {
            return $value;
        }

        if (is_resource($value)) {
            return 'resource';
        }

        return new ObjectStub($value);
    }
26697
protected function serialization($value)
    {
        if (is_array($value) && !empty($value[Serializer::MAP_TYPE])) {
            $data = [];
            foreach ($value[Serializer::SCALAR_VALUE] as $v) {
                $data[] = $this->serialization($v);
            }
        } else {
            $data = $this->serializeObject($value);
        }

        return $data;
    }
345162
protected function serializeValue($value)
    {
        $serialized = var_export($value, true);
        if ($serialized === 'NULL') {
            $serialized = strtolower($serialized);
        }

        return $serialized;
    }
871794
private function getIndividualValue($value)
    {
        if (! is_object($value) || ! $this->em->getMetadataFactory()->hasMetadataFor(StaticClassNameConverter::getClass($value))) {
            return $value;
        }

        return $this->em->getUnitOfWork()->getSingleIdentifierValue($value);
    }