Check if the given object has an identity.

@param object $source the source data
@param string $targetType the type to convert to.
@return boolean true if this TypeConverter can convert from $source to $targetType, false otherwise.
196895
public function canConvertFrom($source, $targetType)
    {
        $identifier = $this->persistenceManager->getIdentifierByObject($source);
        return ($identifier !== null);
    }
1127798
public function matchRules(string $targetType, $targetValue): array
    {
        $query = $this->getRuleSelectQuery();
        $query
            ->innerJoin(
                'r',
                'ngbm_rule_target',
                'rt',
                $query->expr()->eq('r.id', 'rt.rule_id')
            )
            ->where(
                $query->expr()->eq('rd.enabled', ':enabled'),
                $query->expr()->eq('rt.type', ':target_type')
            )
            ->setParameter('target_type', $targetType, Type::STRING)
            ->setParameter('enabled', true, Type::BOOLEAN)
            ->addOrderBy('rd.priority', 'DESC');

        $this->applyStatusCondition($query, Value::STATUS_PUBLISHED, 'r.status');
        $this->applyStatusCondition($query, Value::STATUS_PUBLISHED, 'rt.status');

        if (!isset($this->targetHandlers[$targetType])) {
            throw TargetHandlerException::noTargetHandler('Doctrine', $targetType);
        }

        $this->targetHandlers[$targetType]->handleQuery($query, $targetValue);

        return $query->execute()->fetchAll(PDO::FETCH_ASSOC);
    }
1258376
public function GetSource($Type, $Identifier) {
      $SourceTag = "{$Type}:{$Identifier}";
      if (!array_key_exists($SourceTag, $this->Sources)) return FALSE;
      
      return $this->Sources[$SourceTag];
   }
435204
public function canConvertFrom($source, $targetType)
    {
        if ((
            $this->reflectionService->isClassAnnotatedWith($targetType, Flow\Entity::class) ||
            $this->reflectionService->isClassAnnotatedWith($targetType, Flow\ValueObject::class) ||
            $this->reflectionService->isClassAnnotatedWith($targetType, Entity::class)
        ) === true) {
            return false;
        }

        $methodParameters = $this->reflectionService->getMethodParameters($targetType, '__construct');
        if (count($methodParameters) !== 1) {
            return false;
        }
        $methodParameter = array_shift($methodParameters);
        return TypeHandling::normalizeType($methodParameter['type']) === gettype($source);
    }
966430
public function rename($sourceKey, $targetKey)
    {
        if (false !== $this->write($targetKey, $this->read($sourceKey))) {
            $this->delete($sourceKey);

            return true;
        }

        return false;
    }
1115710
public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null)
    {
        $result = [];
        $array = ('array' === $targetType)
            ? $source
            : $convertedChildProperties;

        foreach ($array as $name => $subProperty) {
            $result[$name] = $subProperty;

            if (is_object($subProperty)
                && in_array(StoreArrayIndexTrait::class, class_uses($subProperty))
            ) {
                /** @var StoreArrayIndexTrait $subProperty */
                $subProperty->setArrayIndex($name);
            }
        }

        return $result;
    }
1328116
public function match($source)
    {
        $this->factory->setType(Token::END);

        return parent::match($source);
    }
841344
public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null)
    {
        if (is_bool($source)) {
            return $source;
        }

        if (is_int($source) || is_float(($source))) {
            return (boolean)$source;
        }

        return (!empty($source) && !in_array(strtolower($source), ['off', 'n', 'no', 'false']));
    }
774773
public function has($source)
    {
        $path = (gettype($source) === 'string')
            ? realpath($source) : $source->getName();

        return $this->sources->containsKey($path);
    }
908665
protected function doMapping($source, $targetType, PropertyMappingConfigurationInterface $configuration, &$currentPropertyPath)
    {
        if ($source === null) {
            return null;
        }

        $typeConverter = $this->getTypeConverter($source, $targetType, $configuration);
        $targetType = ltrim($typeConverter->getTargetTypeForSource($source, $targetType), '\\');

        if (Core::get()->classExists($targetType)) {
            $targetType = $this->handleMixedType($source, $targetType, $currentPropertyPath);
            $source = $this->handleDataPreProcessor($source, $targetType, $currentPropertyPath);

            if (MixedTypesResolver::OBJECT_TYPE_NONE === $targetType) {
                return null;
            }
        }

        $convertedChildProperties = (is_array($source))
            ? $this->convertChildProperties($source, $targetType, $typeConverter, $configuration, $currentPropertyPath)
            : [];

        $this->configurationObjectConversionDTO
            ->setSource($source)
            ->setTargetType($targetType)
            ->setConvertedChildProperties($convertedChildProperties)
            ->setCurrentPropertyPath($currentPropertyPath)
            ->setResult(null);
        $this->serviceFactory->runServicesFromEvent(ObjectConversionBeforeServiceEventInterface::class, 'objectConversionBefore', $this->configurationObjectConversionDTO);

        if (null === $this->configurationObjectConversionDTO->getResult()) {
            $result = $typeConverter->convertFrom($source, $targetType, $convertedChildProperties);
            $this->configurationObjectConversionDTO->setResult($result);
        }

        $this->serviceFactory->runServicesFromEvent(ObjectConversionAfterServiceEventInterface::class, 'objectConversionAfter', $this->configurationObjectConversionDTO);
        $result = $this->configurationObjectConversionDTO->getResult();

        if ($result instanceof Error) {
            $this->messages
                ->forProperty(implode('.', $currentPropertyPath))
                ->addError($result);
        }

        return $result;
    }
1164142
public static function copy(String $source, String $target) : Bool
    {
        return Filesystem::copy(Info::rpath($source), Info::rpath($target));
    }
1108624
public static boolean isAssignable(Class<?> targetType, Class<?> sourceType) {
		if (null == targetType || null == sourceType) {
			return false;
		}

		// 对象类型
		if (targetType.isAssignableFrom(sourceType)) {
			return true;
		}

		// 基本类型
		if (targetType.isPrimitive()) {
			// 原始类型
			Class<?> resolvedPrimitive = BasicType.wrapperPrimitiveMap.get(sourceType);
			if (resolvedPrimitive != null && targetType.equals(resolvedPrimitive)) {
				return true;
			}
		} else {
			// 包装类型
			Class<?> resolvedWrapper = BasicType.primitiveWrapperMap.get(sourceType);
			if (resolvedWrapper != null && targetType.isAssignableFrom(resolvedWrapper)) {
				return true;
			}
		}
		return false;
	}
1162143
protected function extractNodeType($targetType, array $source)
    {
        if (isset($source['__nodeType'])) {
            $nodeTypeName = $source['__nodeType'];
        } else {
            $matches = [];
            preg_match(self::EXTRACT_CONTENT_TYPE_PATTERN, $targetType, $matches);
            if (isset($matches['nodeType'])) {
                $nodeTypeName = $matches['nodeType'];
            } else {
                $nodeTypeName = 'unstructured';
            }
        }
        return $this->nodeTypeManager->getNodeType($nodeTypeName);
    }
885429
public function detectCrossAge($source, $target)
    {
        $source_image = self::encode($source);
        $target_image = self::encode($target);

        return Request::exec(self::DETECT_CROSS_AGE, compact('source_image', 'target_image'));
    }
1276950
protected function merge($target, $source)
    {
        if ($source === null) {
            return $target;
        }

        return call_user_func($this->merge, $target, $source);
    }
253119
public function migrate(stdClass $data, $targetVersion)
    {
        $sourceVersion = $this->versioner->parseVersion($data);

        if (version_compare($targetVersion, $sourceVersion, '>')) {
            $this->up($data, $sourceVersion, $targetVersion);
        } elseif (version_compare($targetVersion, $sourceVersion, '<')) {
            $this->down($data, $sourceVersion, $targetVersion);
        }
    }
535480
protected function hasSharedList($type,$target) {
		$linkType = array($type,$target);
		sort($linkType);
		$linkType = implode('_',$linkType);
		return (in_array($linkType,$this->tables));
	}