@param string $fqcn Fully qualified class name.
@param ClassGenerator $class Class generator object.
@param bool $prefixed

@return string
169415
protected function generateClassNameAndAddImport(string $fqcn, ClassGenerator $class, $prefixed = false): string
    {
        $prefix = '';
        $fqcn = ltrim($fqcn, '\\');
        $parts = explode('\\', $fqcn);
        $className = array_pop($parts);
        if ($prefixed) {
            $prefix = array_pop($parts);
        }
        $classNamespace = implode('\\', $parts);
        $currentNamespace = (string)$class->getNamespaceName();
        if ($prefixed) {
            $className = $prefix.'\\'.$className;
            $fqcn = $classNamespace.'\\'.$prefix;
        }
        if ($classNamespace !== $currentNamespace || !\in_array($fqcn, $class->getUses(), true)) {
            $class->addUse($fqcn);
        }

        return $className;
    }
1306442
final public function generateClass()
    {
        static $docBlock;
        if (empty($docBlock)) {
            $writer = new Writer();
            $writer
                ->writeln('/**')
                ->writeln(' * CG library enhanced proxy class.')
                ->writeln(' *')
                ->writeln(' * This code was generated automatically by the CG library, manual changes to it')
                ->writeln(' * will be lost upon next generation.')
                ->write(' */')
            ;
            $docBlock = $writer->getContent();
        }

        $this->generatedClass = PhpClass::create()
            ->setDocblock($docBlock)
            ->setParentClassName($this->class->name)
        ;

        $proxyClassName = $this->getClassName($this->class);
        if (false === strpos($proxyClassName, NamingStrategyInterface::SEPARATOR)) {
            throw new \RuntimeException(sprintf('The proxy class name must be suffixed with "%s" and an optional string, but got "%s".', NamingStrategyInterface::SEPARATOR, $proxyClassName));
        }
        $this->generatedClass->setName($proxyClassName);

        if (!empty($this->interfaces)) {
            $this->generatedClass->setInterfaceNames(array_map(function($v) { return '\\'.$v; }, $this->interfaces));

            foreach ($this->getInterfaceMethods() as $method) {
                $method = PhpMethod::fromReflection($method);
                $method->setAbstract(false);

                $this->generatedClass->setMethod($method);
            }
        }

        if (!empty($this->generators)) {
            foreach ($this->generators as $generator) {
                $generator->generate($this->class, $this->generatedClass);
            }
        }

        return $this->generateCode($this->generatedClass);
    }
1180658
public function generate(ReflectionClass $originalClass, ClassGenerator $classGenerator)
    {
        CanProxyAssertion::assertClassCanBeProxied($originalClass);

        $publicProperties = new PublicPropertiesMap(Properties::fromReflectionClass($originalClass));
        $interfaces       = [AccessInterceptorValueHolderInterface::class];

        if ($originalClass->isInterface()) {
            $interfaces[] = $originalClass->getName();
        } else {
            $classGenerator->setExtendedClass($originalClass->getName());
        }

        $classGenerator->setImplementedInterfaces($interfaces);
        $classGenerator->addPropertyFromGenerator($valueHolder        = new ValueHolderProperty($originalClass));
        $classGenerator->addPropertyFromGenerator($prefixInterceptors = new MethodPrefixInterceptors());
        $classGenerator->addPropertyFromGenerator($suffixInterceptors = new MethodSuffixInterceptors());
        $classGenerator->addPropertyFromGenerator($publicProperties);

        array_map(
            static function (MethodGenerator $generatedMethod) use ($originalClass, $classGenerator) : void {
                ClassGeneratorUtils::addMethodIfNotFinal($originalClass, $classGenerator, $generatedMethod);
            },
            array_merge(
                array_map(
                    $this->buildMethodInterceptor($prefixInterceptors, $suffixInterceptors, $valueHolder),
                    ProxiedMethodsFilter::getProxiedMethods($originalClass)
                ),
                [
                    Constructor::generateMethod($originalClass, $valueHolder),
                    new StaticProxyConstructor($originalClass, $valueHolder, $prefixInterceptors, $suffixInterceptors),
                    new GetWrappedValueHolderValue($valueHolder),
                    new SetMethodPrefixInterceptor($prefixInterceptors),
                    new SetMethodSuffixInterceptor($suffixInterceptors),
                    new MagicGet(
                        $originalClass,
                        $valueHolder,
                        $prefixInterceptors,
                        $suffixInterceptors,
                        $publicProperties
                    ),
                    new MagicSet(
                        $originalClass,
                        $valueHolder,
                        $prefixInterceptors,
                        $suffixInterceptors,
                        $publicProperties
                    ),
                    new MagicIsset(
                        $originalClass,
                        $valueHolder,
                        $prefixInterceptors,
                        $suffixInterceptors,
                        $publicProperties
                    ),
                    new MagicUnset(
                        $originalClass,
                        $valueHolder,
                        $prefixInterceptors,
                        $suffixInterceptors,
                        $publicProperties
                    ),
                    new MagicClone($originalClass, $valueHolder, $prefixInterceptors, $suffixInterceptors),
                    new MagicSleep($originalClass, $valueHolder),
                    new MagicWakeup($originalClass),
                ]
            )
        );
    }
541922
public function postProcessGeneratedCode(string $generated, ?PostProcessorInterface $postProcessor = null): string
    {

        $generated = $this->fixSuppressWarningsTags($generated);
        $generated = $this->breakImplementsAndExtendsOntoLines($generated);
        $generated = $this->makeConstsPublic($generated);
        $generated = $this->constArraysOnMultipleLines($generated);
        $generated = $this->phpcsIgnoreUseSection($generated);
        $generated = $this->declareStrictFirstLine($generated);
        if (null !== $postProcessor) {
            $generated = $postProcessor($generated);
        }

        return $generated;
    }
1170171
public function getFqnClassName(ClassMetadata $classMetadata): string
    {
        return $this->getNamespaceForClass($classMetadata).'\\'.$this->getClassName($classMetadata);
    }
825499
protected function parseClassEvent( $class, $prefix )
	{
		if ( Str::contains( $class, '@' ) )
			return explode( '@', $class );

		$method = Str::contains( $prefix, 'composing' ) ? 'compose' : 'create';

		return [$class, $method];
	}
366673
public function getChildDefinitionsForFqn(string $fqn): \Generator
    {
        $parts = $this->splitFqn($fqn);
        if ('' === end($parts)) {
            // we want to return all the definitions in the given FQN, not only
            // the one (non member) matching exactly the FQN.
            array_pop($parts);
        }

        $result = $this->getIndexValue($parts, $this->definitions);
        if (!$result) {
            return;
        }
        foreach ($result as $name => $item) {
            // Don't yield the parent
            if ($name === '') {
                continue;
            }
            if ($item instanceof Definition) {
                yield $fqn.$name => $item;
            } elseif (is_array($item) && isset($item[''])) {
                yield $fqn.$name => $item[''];
            }
        }
    }
636867
public static function fqcnToBlockPrefix(string $fqcn): ?string
    {
        // Non-greedy ("+?") to match "type" suffix, if present
        if (preg_match('~([^\\\\]+?)(type)?$~i', $fqcn, $matches)) {
            return mb_strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], ['\\1_\\2', '\\1_\\2'], $matches[1]));
        }

        return null;
    }
545416
private <T> T getCached(String prefix, String postfix, Class<T> cls) {
    return cls.cast(cache.get(prefix + '.' + postfix));
  }
717907
private Class<?> resolveJavaClass(final String fqn) throws ClassNotFoundException {
        String[] parts = fqn.split("\\.");
        if (parts.length < 2) {
            throw new JsiiException("Malformed FQN: " + fqn);
        }

        String moduleName = parts[0];

        JsonNode names = this.getClient().getModuleNames(moduleName);
        if (!names.has("java")) {
            throw new JsiiException("No java name for module " + moduleName);
        }

        final JsiiModule module = this.loadedModules.get(moduleName);
        if (module == null) {
            throw new JsiiException("No loaded module is named " + moduleName);
        }
        return module.resolveClass(fqn);
    }
256462
private function getRoamedCompletions(string $prefix): \Generator
    {
        foreach ($this->index->getChildDefinitionsForFqn('') as $fqn => $def) {
            if (!$def->roamed || !nameStartsWith($fqn, $prefix)) {
                continue;
            }
            $completionItem = CompletionItemFactory::fromDefinition($def);
            // Second-guessing the user here - do not trust roaming to work. If the same symbol is
            // inserted in the current namespace, the code will stop working.
            $completionItem->insertText =  '\\' . $fqn;
            yield $fqn => $completionItem;
        }
    }
698213
private function getClassName($table, $prefix)
    {
        $prefixLen = strlen($prefix);
        if(substr($table, 0, $prefixLen) === $prefix)
        {
            $table = substr($table, $prefixLen);
        }
        return Text::toPascalName($table);
    }
385658
private static function getContainingClassFqn(Node $node)
    {
        $classNode = $node->getFirstAncestor(Node\Statement\ClassDeclaration::class);
        if ($classNode === null) {
            return null;
        }
        return (string)$classNode->getNamespacedName();
    }
1057907
public function getFormzGeneratedFilePath($prefix = '')
    {
        $formObject = $this->assetHandlerFactory->getFormObject();
        $formIdentifier = CacheService::get()->getFormCacheIdentifier($formObject->getClassName(), $formObject->getName());
        $prefix = (false === empty($prefix))
            ? $prefix . '-'
            : '';

        $identifier = substr(
            'fz-' . $prefix . $formIdentifier,
            0,
            22
        );
        $identifier .= '-' . md5($formObject->getHash() . $formObject->getName());

        return CacheService::GENERATED_FILES_PATH . $identifier;
    }
358364
public function filterByPrefix(string $prefixFilter): ClassNameIndex
    {
        $pointcuts = array_keys($this->classNames);
        $result = new ClassNameIndex();

        $right = count($pointcuts) - 1;
        $left = 0;

        $found = false;
        $currentPosition = -1;
        while ($found === false) {
            if ($left > $right) {
                break;
            }
            $currentPosition = $left + floor(($right - $left) / 2);
            if (strpos($pointcuts[$currentPosition], $prefixFilter) === 0) {
                $found = true;
                break;
            } else {
                $comparisonResult = strcmp($prefixFilter, $pointcuts[$currentPosition]);
                if ($comparisonResult > 0) {
                    $left = $currentPosition + 1;
                } else {
                    $right = $currentPosition - 1;
                }
            }
        }

        if ($found === true) {
            $startIndex = $currentPosition;
            while ($startIndex >= 0 && strpos($pointcuts[$startIndex], $prefixFilter) === 0) {
                $startIndex--;
            }
            $startIndex++;
            $endIndex = $currentPosition;
            while ($endIndex < count($pointcuts) && strpos($pointcuts[$endIndex], $prefixFilter) === 0) {
                $endIndex++;
            }

            $result->setClassNames(array_slice($pointcuts, $startIndex, $endIndex - $startIndex));
        }
        return $result;
    }
223651
protected function generate(FileGenerator $generator)
    {
        $fqcn = $this->convertToFullQualifyClassName($this->getNameInput());

        $path = $this->getRelativePath($fqcn).'.php';

        if ($generator->exists($path)) {
            $this->error($this->type.' already exists!');

            return false;
        }

        return $this->generateFile($generator, $path, $fqcn);
    }
703773
static String generateFieldContextDeclaration(
            final String className,
            final String checkName,
            final String fieldName) {
        return "private static final net.sf.oval.context.OValContext " + checkName + "_CONTEXT"
                + " = new net.sf.oval.context.FieldContext(" + className + ".class, \"" + fieldName + "\");";
    }