From submitted value to object.

@param string $value

@return mixed
544197
public function fromRaw($value)
    {
        $type = $this->getDataType();

        if ($type === 'json') {
            $value = json_decode($value, true);
        } elseif ($type === 'array') {
            $value = (array) $value;
        } elseif ($type === 'list') {
            $value = explode(',', $value);
        } elseif ($type === 'boolean') {
            $value = $value ? '1' : '0';
        } elseif ($type === 'integer') {
            if (strlen($value)) {
                $value = (int) $value;
            } else {
                $value = null;
            }
        } elseif ($type === 'float') {
            if (strlen($value)) {
                $value = (float) $value;
            } else {
                $value = null;
            }
        }

        return $value;
    }
392371
protected function extract($value)
    {
        /** @var $object Helper\StorageObject */
        $object = unserialize($value);
        if ($value === $object) {
            return null;
        }

        if (!($object instanceof Helper\StorageObject)) {
            return null;
        }

        if ($object->isExpired()) {
            return null;
        }

        return $object->value();
    }
215527
private static function tostring($value) : string
    {
        if (!isset($value)) {
            return 'NULL';
        }
        if ($value === true) {
            return 'true';
        }
        if ($value === false) {
            return 'false';
        }
        if (is_numeric($value)) {
            return $value;
        }
        if (is_string($value)) {
            return "'$value'";
        }
        if (is_array($value)) {
            $out = '[';
            $i = 0;
            foreach ($value as $key => $entry) {
                if ($i) {
                    $out .= ', ';
                }
                $out .= $key.' => '.self::tostring($entry);
                $i++;
            }
            $out .= ']';
            return $out;
        }
        if (is_object($value)) {
            if (method_exists($value, '__toString')) {
                return "$value";
            } else {
                return get_class($value);
            }
        }
    }
688868
public function serialize($value)
    {
        if ($this->getDataType() === 'json') {
            return json_encode($value);
        } elseif ($this->getDataType() === 'array') {
            return json_encode($value);
        } elseif ($this->getDataType() === 'list') {
            return implode(',', $value);
        }

        return trim($value);
    }
354817
public function toObject($value)
    {
        if (!is_array($value)) {
            throw new TypeCastException('Is not array');
        }

        foreach ($this->rules as $class => $rule) {
            if ($this->isMatch($rule, $value)) {
                return $this->createInstance($class, $value);
            }
        }

        throw new TypeCastException('Rule not found');
    }
671014
public function fromDateTime($value)
    {
        $format = $this->getDateFormat();

        $value = $this->asDateTime($value);

        return $value->format($format);
    }
1338137
public static function serializeValue($value)
    {
        if ($value instanceof JsonSerializable || $value instanceof \JsonSerializable) {
            return $value->jsonSerialize();
        }

        if (is_object($value)) {
            foreach (get_object_vars($value) as $nestedKey => $nestedValue) {
                $value->{$nestedKey} = self::serializeValue($nestedValue);
            }

            return $value;
        }

        if (is_array($value)) {
            foreach ($value as &$nestedValue) {
                $nestedValue = self::serializeValue($nestedValue);
            }

            return $value;
        }

        if ($value instanceof DateTime || $value instanceof \DateTimeInterface) {
            throw new DomainException('Please wrap your DateTime objects with Aplazame\Serializer\Date::fromDateTime');
        }

        if (is_float($value)) {
            throw new DomainException('Please wrap your float values with Aplazame\Serializer\Decimal::fromFloat');
        }

        return $value;
    }
879286
public function toString($value) {
		if (is_null($value))
			return null;
		elseif (is_string($value))
			return $value;
		elseif (is_resource($value) || is_array($value))
			return false;
		elseif (is_object($value)) {
			if (method_exists($value, '__toString')) {
				$rm = (new \ReflectionClass($value))->getMethod('__toString');
				if ($rm->isPublic())
					return $value->__toString();
				return false;
			}
	
			return false;
		}
	
		return strval($value);
	}
1110259
public static function copy($value){
		
		if(\is_object($value)){
			
			if(\is_callable($value)){
				return \Closure::bind($value, null);
			}
			
			return clone $value;
			
		}
		
		return $value;
		
	}
225760
public static function FromValue( $value )
	{
		if ( is_string( $value ) && ( ! is_numeric( $value ) || ( ! is_int( $value + 0 ) && is_double( $value + 0 ) ) ) )
		{
			throw XPath2Exception::withErrorCodeAndParams( "FORG0001", Resources::FORG0001, array( $value, "integer" ) );
		}

		if ( is_numeric( $value ) )
		{
			if ( is_infinite( $value ) )
				throw XPath2Exception::withErrorCodeAndParams( "FOAR0001", Resources::FOAR0001, array( $value, "integer" ) );

			if ( $value > PHP_INT_MAX || $value < PHP_INT_MIN )
				throw XPath2Exception::withErrorCodeAndParams( "FOAR0002", Resources::FOAR0002, array( $value, "integer" ) );
		}

		return new Integer( $value );
	}
921735
protected function normalizePropertyValue($value)
    {
        if (false === is_scalar($value)) {
            return $value;
        }

        return Value::fromJsonLd((object) array('@value' => $value));
    }
1053989
public function convertJsonToArray($value) {

		if(true === $this -> convert_json) {

			if(true === is_string($value)) {

				$tmp = @json_decode($value, true);

				if(true === (json_last_error() == JSON_ERROR_NONE)) {
					$value = $tmp;
				}
			}
		}

		return $value;
	}
681628
private function serializeValue($value)
    {
        if (is_object($value)) {
            return $this->serializeObjectRecursively($value);
        } elseif (is_array($value)) {
            return $this->serializeArrayRecursively($value);
        }

        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;
    }
17493
protected function extractObject($value)
    {
        if (empty($value)) {
            return (Object) [];
        }

        if ($value instanceof \Traversable) {
            $array = [];
            foreach ($value as $key => $value) {
                $array[$key] = $value;
            }
            return (Object) $array;
        }

        return (Object) $value;
    }
1302011
public static function convertToDb($value)
    {
        $dbValue = null;

        if (is_array($value)) {
            $dbValue = (object) $value;
        } elseif ($value instanceof \ArrayObject) {
            $dbValue = (object) $value->getArrayCopy();
        } elseif (is_object($value)) {
            $dbValue = (object) get_object_vars($value);
        }

        if (!is_null($dbValue)) {
            $dbValue = (object) self::processDynamicParts($dbValue);
        }

        return $dbValue;
    }
1228025
public function reverseTransform($value)
    {
        if (null === $value) {
            return null;
        }

        $repo = $this->em->getRepository($this->className);
        $entity = $repo->find($value);

        if (!$entity) {
            return null;
        }

        return $entity;
    }