Get the inverse of a hasType

@param string $hasType

@return string
@throws DoctrineStaticMetaException
@SuppressWarnings(PHPMD.CyclomaticComplexity)
427779
protected function getInverseHasType(string $hasType): string
    {
        switch ($hasType) {
            case self::HAS_ONE_TO_ONE:
            case self::HAS_REQUIRED_ONE_TO_ONE:
            case self::HAS_MANY_TO_MANY:
            case self::HAS_REQUIRED_MANY_TO_MANY:
                return \str_replace(
                    self::PREFIX_OWNING,
                    self::PREFIX_INVERSE,
                    $hasType
                );

            case self::HAS_INVERSE_ONE_TO_ONE:
            case self::HAS_REQUIRED_INVERSE_ONE_TO_ONE:
            case self::HAS_INVERSE_MANY_TO_MANY:
            case self::HAS_REQUIRED_INVERSE_MANY_TO_MANY:
                return \str_replace(
                    self::PREFIX_INVERSE,
                    self::PREFIX_OWNING,
                    $hasType
                );

            case self::HAS_MANY_TO_ONE:
                return self::HAS_ONE_TO_MANY;

            case self::HAS_REQUIRED_MANY_TO_ONE:
                return self::HAS_REQUIRED_ONE_TO_MANY;

            case self::HAS_ONE_TO_MANY:
                return self::HAS_MANY_TO_ONE;

            case self::HAS_REQUIRED_ONE_TO_MANY:
                return self::HAS_REQUIRED_MANY_TO_ONE;

            default:
                throw new DoctrineStaticMetaException(
                    'invalid $hasType ' . $hasType . ' when trying to get the inverted relation'
                );
        }
    }
1355912
private function getOffset($stepSize)
    {
        $stepOffset = $stepSize / $this->size * mt_rand(-$this->size, $this->size);
        $sign = $stepOffset < 0 ? -1 : 1;
        return $sign * pow(abs($stepOffset), 1 / sqrt($this->getPersistence()));
    }
807640
public function getHasSingularInterfaceFqnForEntity(
        string $entityFqn
    ): string {
        try {
            $interfaceNamespace = $this->getInterfacesNamespaceForEntity($entityFqn);

            return $interfaceNamespace . '\\Has' . ucfirst($entityFqn::getDoctrineStaticMeta()->getSingular())
                   . 'Interface';
        } catch (\Exception $e) {
            throw new DoctrineStaticMetaException(
                'Exception in ' . __METHOD__ . ': ' . $e->getMessage(),
                $e->getCode(),
                $e
            );
        }
    }
14791
public function getHelper($helperType)
    {
        if ($this->isValidKey($helperType)) {
            return $this->getHelperMap()->get($helperType);
        } else {
            throw new InvalidArgumentException('Invalid form helper type given');
        }
    }
44794
private function getNewPathFromArchetypePath(string $archetypePath): string
    {
        $rootArchetypePath = substr($archetypePath, 0, \ts\strpos($archetypePath, '/src/Entity/Embeddable'));

        $path = \str_replace($rootArchetypePath, $this->pathToProjectRoot, $archetypePath);

        $pattern     = '%^(.*?)/([^/]*?)' . $this->archetypeObjectClassName . '([^/]*?)php$%m';
        $replacement = '$1/$2' . $this->newObjectClassName . '$3php';

        $path = \preg_replace($pattern, $replacement, $path, -1, $replacements);
        if (0 === $replacements) {
            throw new \RuntimeException('Failed updating the path with regex in ' . __METHOD__);
        }

        return $path;
    }
30910
public function find($documentName, $identifier, $lockMode = LockMode::NONE, $lockVersion = null) : ?object
    {
        $repository = $this->getRepository($documentName);
        if ($repository instanceof DocumentRepository) {
            return $repository->find($identifier, $lockMode, $lockVersion);
        }

        return $repository->find($identifier);
    }
396330
public function getLocalization($locale)
	{
		$localization = parent::getLocalization($locale);
		
		// Create fake localization if not persisted
		if (is_null($localization)) {
			$localization = $this->createLocalization($locale);
		}
		
		return $localization;
	}
495887
public function getUnitPriceFormatted($locale = null)
    {
        $formatter = $this->getFormatter($locale);

        return $formatter->format((float)$this->getUnitPrice());
    }
1012475
public static function localeHasShortUnits($locale)
    {
        return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) {
            return $newLocale &&
                (
                    ($y = static::translateWith($translator, 'y')) !== 'y' &&
                    $y !== static::translateWith($translator, 'year')
                ) || (
                    ($y = static::translateWith($translator, 'd')) !== 'd' &&
                    $y !== static::translateWith($translator, 'day')
                ) || (
                    ($y = static::translateWith($translator, 'h')) !== 'h' &&
                    $y !== static::translateWith($translator, 'hour')
                );
        });
    }
1074580
public function getNextPageUrl($uriType = Router::ABSOLUTE_PATH)
    {
        $currentPage = $this->getCurrentPage();
        if ($currentPage < $this->getPagesCount()) {
            return $this->getPageUrl($currentPage+1, $uriType);
        }

        return null;
    }
317912
protected function getEntityMapInstanceFromCache(string $entityClass)
    {
        if ($this->cache == null) {
            return;
        }

        if ($this->cache->has($entityClass)) {
            return unserialize($this->cache->get($entityClass));
        }
    }
470851
public function findMetaTag($key, $locale = null)
    {
        $criteria = array('keyword' => $key);
        if ($locale && property_exists($this->entityClass, 'locale')) {
            $criteria['locale'] = $locale;
        }

        return $this->getRepository()->findOneBy($criteria);
    }
84035
protected function getPhpTypeForDbalType(): string
    {
        if (true === $this->isArchetype) {
            return '';
        }
        if (!\in_array($this->fieldType, MappingHelper::COMMON_TYPES, true)) {
            throw new DoctrineStaticMetaException(
                'Field type of ' .
                $this->fieldType .
                ' is not one of MappingHelper::COMMON_TYPES'
                .
                "\n\nYou can only use this fieldType type if you pass in the explicit phpType as well "
                .
                "\n\nAlternatively, suggest you set the type as string and then edit the generated code as you see fit"
            );
        }

        return MappingHelper::COMMON_TYPES_TO_PHP_TYPES[$this->fieldType];
    }
138378
private function getArguments(StepNode $step)
    {
        if (! $step->hasArguments()) {
            return;
        }

        return implode(
            array_map(
                function (ArgumentInterface $argument) {
                    if (in_array($argument->getNodeType(), ['Table', 'ExampleTable'])) {
                        return implode(
                            array_map(
                                function ($arguments) {
                                    return $this->indent(self::INDENTATION * 2 + 4) . trim($arguments) . "\n";
                                },
                                explode("\n", $argument->getTableAsString())
                            )
                        );
                    }

                    if ('PyString' === $argument->getNodeType()) {
                        return $this->encapsulateAsPyString(
                            implode(
                                array_map(
                                    function ($arguments) {
                                        return rtrim($this->indent(self::INDENTATION * 2 + 2) . trim($arguments)) . "\n";
                                    },
                                    $argument->getStrings()
                                )
                            )
                        );
                    }
                },
                $step->getArguments()
            )
        );
    }
841681
public function findCanonical(string $locale): ?Scope
    {
        $canonicals = $this->config->get('canonicals');

        if (!isset($canonicals[$locale])) {
            return null;
        }

        $scope = $this->findByRoot($canonicals[$locale]);

        return $scope->setCustomRoot(Root::fromString($canonicals[$locale]));
    }
826476
protected function getLocale($locale)
    {
        $result = null;
        if ($locale instanceof LocaleEntity) {
            $result = $locale;
        } elseif (is_string($locale) && $locale !== '') {
            $result = $this->app->make(LocaleRepository::class)->findApproved($locale);
        }

        return $result;
    }
592143
public static function getRetenido($OtrosImp)
    {
        $retenido = 0;
        foreach ($OtrosImp as $Imp) {
            if (self::getTipo($Imp['CodImp'])=='R') {
                $retenido += $Imp['MntImp'];
            }
        }
        return $retenido;
    }