@param mixed $value

@return \Fubhy\GraphQL\Type\Definition\Types\ObjectType|null

@throws \Exception
499048
public function getTypeOf($value)
    {
        foreach ($this->getPossibleTypes() as $type) {
            if ($isTypeOf = $type->isTypeOf($value)) {
                return $type;
            }

            if (!isset($isTypeOf)) {
                throw new \Exception(sprintf(
                    'Non-Object Type %s does not implement resolveType and Object ' .
                    'Type %s does not implement isTypeOf. There is no way to ' .
                    'determine if a value is of this type.', $this->getName(), $type->getName()
                ));
            }
        }

        return NULL;
    }
892017
public function extract($value)
    {
        if ($value instanceof DateTime) {
            return $value->format($this->getFormat());
        }

        if ($this->nullable && $value === null) {
            return null;
        }

        throw new Exception\InvalidArgumentException(sprintf(
            'Invalid value: must be an instance of DateTime, "%s" given.',
            is_object($value) ? get_class($value) : gettype($value)
        ));
    }
726026
public static function proxyType($value = null)
    {
        if (empty($value)) {
            return self::$global->getProxyType();
        }
        self::$global->setProxyType($value);
    }
891343
public static function tryGetTypeForValue($value)
    {
        if (!is_object($value)) {
            return null;
        }

        // maybe it's a ValueObject

        // try get type name from types map
        $className = get_class($value);
        if (isset(self::$typesMap[$className])) {
            return Type::getType(self::$typesMap[$className]);
        }

        // use class name as type name
        $classNameParts = explode('\\', $className);
        $typeName = array_pop($classNameParts);

        if (array_key_exists($typeName, Type::getTypesMap())) {
            return Type::getType($typeName);
        }

        return null;
    }
197635
public static function Create( $value )
	{
		if ( $value instanceof ValueProxy )
			return $value;
		try
		{
			if ( $value instanceof XPath2Item )
			{
				$valueType = $value->getValueType();
				$typeName = $valueType->getTypeName();
				$value = $value->getTypedValue();
			}
			else if ( $value instanceof IXmlSchemaType )
			{
				$typeName = $value::$CLASSNAME;
			}
			else
			{
				$typeName = Type::FromValue( $value )->getTypeName();
			}

			if ( ! isset( ValueProxy::$valueFactory[ $typeName ] ) )
			{
				throw new KeyNotFoundException();
			}

			return ValueProxy::$valueFactory[ $typeName ]->Create( $value );
		}
		catch ( KeyNotFoundException $ex )
		{
			$className = get_class( $value );
			if ( is_null( $value ) )
				throw XPath2Exception::withErrorCodeAndParam( "XPTY0004", "The type {0} is not registred in ValueProxy", $className);
			else
				throw new InvalidCastException( "The type {$className} is not registred in ValueProxy" );
		}
	}
202530
public function phpTypecastComposite($value)
    {
        if (is_string($value)) {
            $value = $this->getCompositeParser()->parse($value);
        }
        if (is_array($value)) {
            $result = [];
            $fields = array_keys($this->columns);
            foreach ($value as $i => $item) {
                $field = is_int($i) ? $fields[$i] : $i;
                if (isset($this->columns[$field])) {
                    $result[$field] = $this->columns[$field]->phpTypecast($item);
                }
            }

            return $this->createCompositeObject($result);
        } elseif (!$value instanceof $this->phpType) {
            return null;
        }

        return $value;
    }
453577
protected function serializeData($value)
    {
        $this->guardForUnsupportedValues($value);

        if ($this->isInstanceOf($value, 'SplFixedArray')) {
            return SplFixedArraySerializer::serialize($this, $value);
        }

        if (\is_object($value)) {
            return $this->serializeObject($value);
        }

        $type = (\gettype($value) && $value !== null) ? \gettype($value) : 'string';
        $func = $this->serializationMap[$type];

        return $this->$func($value);
    }
346335
public function hydrate($value)
    {
        if ($this->nullable && $value === null) {
            return null;
        }

        if (is_string($value) || is_int($value)) {
            if ($dateTime = DateTime::createFromFormat($this->getFormat(), $value)) {
                return $dateTime;
            }

            throw new Exception\InvalidArgumentException(sprintf(
                'Invalid format or value: format must be a string representing a valid \DateTime format, "%s" given;' .
                'value must be a string representing the time according to \DateTime::createFromFormat(), "%s" given.',
                $this->getFormat(),
                $value
            ));
        }

        throw new Exception\InvalidArgumentException(sprintf(
            'Invalid value: must be a string or integer representing the time according to the format, "%s" given',
            is_object($value) ? get_class($value) : gettype($value)
        ));
    }
1097467
public function getTypeForValue($value) : string
    {
        foreach ($this->handlers as $type => $handler) {
            if ($handler->canHandleValue($value)) {
                return $type;
            }
        }

        throw DataTypeException::handlerNotFoundForValue($value);
    }
1172248
protected function getSerializedPropertyValue($value)
    {
        return ($value instanceof QueueableEntityInterface)
            ? new ModelIdentifier(get_class($value), $value->getQueueableId()) : $value;
    }
276820
public function asValue($value)
        {
            $endPoint =& $this->_getEndPoint();
            $endPoint['lookupType'] = self::TYPE_VALUE;
            $endPoint['value'] = $value;

            return $this;
        }
812756
public function transform($value)
    {
        if (null === $value) {
            return null;
        }

        if (!$value instanceof APILocation) {
            throw new TransformationFailedException('Expected a ' . APILocation::class . ' object.');
        }

        return $value->id;
    }
1280474
public function getPDOType($value) {
        $type= null;
        if (is_null($value)) $type= \PDO::PARAM_NULL;
        elseif (is_scalar($value)) {
            if (is_int($value)) $type= \PDO::PARAM_INT;
            else $type= \PDO::PARAM_STR;
        }
        return $type;
    }
968745
public static function getType($value)
    {
        if ($value === null) {
            return null;
        }

        $type = gettype($value);
        if (is_array($value) && !empty($value)) {
            $arrayType = null;
            foreach ($value as $entry) {
                if ($arrayType == null) {
                    $arrayType = self::getType($entry);
                } else {
                    return "mixed[]";
                }
            }
            return $arrayType . "[]";
        } elseif ($type == 'object') {
            return get_class($value);
        }

        return self::mapToBuiltInType($type);
    }
1231895
protected function phpTypecastValue($value)
    {
        if ($value === null) {
            return null;
        }

        switch ($this->type) {
            case Schema::TYPE_BOOLEAN:
                switch (strtolower($value)) {
                    case 't':
                    case 'true':
                        return true;
                    case 'f':
                    case 'false':
                        return false;
                }
                return (bool) $value;
            case Schema::TYPE_BIT:
                return bindec($value);
            case Schema::TYPE_BINARY:
                return is_string($value) && strncmp($value, '\\x', 2) === 0 ? pack('H*', substr($value, 2)) : $value;
            case Schema::TYPE_JSON:
                return json_decode($value, true);
            case Schema::TYPE_TIMESTAMP:
            case Schema::TYPE_TIME:
            case Schema::TYPE_DATE:
            case Schema::TYPE_DATETIME:
                return new \DateTime($value);
            case Schema::TYPE_COMPOSITE:
                return $this->phpTypecastComposite($value);
        }

        return $this->typecast($value);
    }
846813
function parseValue($value) {
        try {
            return \Plasma\Types\TypeExtensionsManager::getManager()->decodeType($this->type, $value)->getValue();
        } catch (\Plasma\Exception $e) {
            /* Continue regardless of error */
        }
        
        return $value;
    }
195788
public function reverseTransform($value)
    {
        return null !== $value && !empty($value)
            ? $this->contentTypeService->loadContentTypeByIdentifier($value)
            : null;
    }