Replace dummy name to real name

@param $className
@param $namespace
@return array
323610
protected function replaceStubString($className, $namespace)
    {
        return array_merge([
            'VENDOR_NAME_LOWER'  => strtolower($this->vendor),
            'VENDOR_NAME'        => studly_case($this->vendor),
            'PACKAGE_NAME_LOWER' => strtolower($this->package),
            'PACKAGE_NAME'       => studly_case($this->package),
            'DummyClass'         => studly_case($className),
            'DummyTarget'        => strtolower($className),
            'DummyNamespace'     => $this->namespace . $namespace,
            'DummyRootNamespace' => $this->laravel->getNamespace(),
        ], $this->config->get('tie.stubs.replace'));
    }
170130
public static function splitClassName ( $className )
    {
        $chunk = explode('\\', $className);
        $className = array_pop($chunk);
        $namespace = implode('\\', $chunk);
        $result = array($namespace, $className);
        return $result;
    }
1032842
public function getClassPropertyNames($className)
    {
        if (!isset($this->reflectedClassNames[$className])) {
            $this->reflectClass($className);
        }
        return isset($this->classPropertyNames[$className]) ? $this->classPropertyNames[$className] : [];
    }
723926
private function getNewEmbeddableFqnFromClassName(string $className): string
    {
        return $this->namespaceHelper->tidy(
            $this->projectRootNamespace . '\\'
            . implode('\\', \array_slice($this->archetypeObjectSubDirectories, 1))
            . '\\' . $className
        );
    }
1019116
public static function getNamespace($className)
        {
            $className = trim($className, '\\');

            if ($lastSeparator = strrpos($className, '\\')) {
                return substr($className, 0, $lastSeparator + 1);
            }

            return '';
        }
762181
protected function resolveClassName(Name $name): Name
    {
        // Skip all names except special `self`
        if (strtolower($name->toString()) !== 'self') {
            return $name;
        }

        // Save the original name
        $originalName = $name;
        $name = clone $originalName;
        $name->setAttribute('originalName', $originalName);

        $fullClassName    = Name::concat($this->namespace, $this->className);
        $resolvedSelfName = new FullyQualified('\\' . ltrim($fullClassName->toString(), '\\'), $name->getAttributes());

        $this->replacedNodes[] = $resolvedSelfName;

        return $resolvedSelfName;
    }
105443
public function basename(string $namespace): string
    {
        $strrpos = \strrpos($namespace, '\\');
        if (false === $strrpos) {
            return $namespace;
        }

        return $this->tidy(\substr($namespace, $strrpos + 1));
    }
1249219
public function getIdentifier($namespace)
    {
        $namespace = Str::normalizeClassName($namespace);
        if (strpos($namespace, '\\') === null) {
            return $namespace;
        }

        $parts = explode('\\', $namespace);
        $slice = array_slice($parts, 1, 2);
        $namespace = implode('.', $slice);

        return $namespace;
    }
271333
public function loadClass($className)
    {
        foreach ($this->namespaces as $namespace => $path) {
            if (null === $namespace || $namespace === substr($className, 0, strlen($namespace))) {
                $fileName = '';
                $namespace = '';

                if (false !== ($lastNsPos = strripos($className, $this->namespaceSeparator))) {
                    $namespace = substr($className, 0, $lastNsPos);
                    $className = substr($className, $lastNsPos + 1);
                    $fileName = str_replace(
                        $this->namespaceSeparator,
                        DIRECTORY_SEPARATOR,
                        $namespace
                    ) . DIRECTORY_SEPARATOR;
                }

                $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . $this->fileExtension;

                $this->requireFile(($path !== null ? $path . DIRECTORY_SEPARATOR : '') . $fileName);

                break;
            }
        }

        return $this;
    }
155611
private function getClassNameCandidates(array $namespaces, $name)
    {
        $className = str_replace(' ', '', ucwords($name));

        return array_map(function ($namespace) use ($className) { return $namespace.$className; }, $namespaces);
    }
937810
public static function var_names_from_context($classname, $pluginname = '') {
        $pluginname = trim($pluginname);
        if (!empty($pluginname)) {
            $categoryvar = $classname . '_' . $pluginname . '_category';
            $purposevar = $classname . '_' . $pluginname . '_purpose';
        } else {
            $categoryvar = $classname . '_category';
            $purposevar = $classname . '_purpose';
        }
        return [
            $purposevar,
            $categoryvar
        ];
    }
1305022
public function getDescriptor(string $classNamespace): ?Descriptor
    {
        if (!$this->isEmpty()) {
            /** @var Descriptor $descriptor */
            foreach ($this as $rootNamespace => $descriptor) {
                $rootNamespace = $descriptor->getRootNamespace();

                $doubleSlashed = str_replace('\\', '\\\\', $rootNamespace);
                $pattern = sprintf('|^%s\\.*|', $doubleSlashed);

                if (preg_match($pattern, $classNamespace)) {
                    return $descriptor;
                }
            }
        }

        return null;
    }
57935
private function generateClassName($fullClassName)
    {
        $namespace = $this->getClassNamespace($fullClassName);

        $className = $fullClassName;

        if ($namespace) {
            $className = substr($fullClassName, strrpos($fullClassName, '\\') + 1, strlen($fullClassName));
        }

        return $className;
    }
1319500
public static function getShortClassname($classname)
    {
        if (is_array($classname)) {
            return  array_map(['BackBee\ClassContent\AbstractContent', 'getShortClassname'], $classname);
        }

        if (in_array($classname, ['scalar', 'array'])) {
            return $classname;
        }

        $isExcluded = self::isExcludedClassname($classname);

        try {
            if (!is_subclass_of($classname, 'BackBee\ClassContent\AbstractClassContent')) {
                throw new ClassNotFoundException();
            }
        } catch (ClassNotFoundException $ex) {
            return self::onUnknownClassname(
                sprintf('Given classname %s is not a subclass of AbstractClassContent.', $classname),
                $ex
            );
        }

        return ($isExcluded ? '!' : '').str_replace(self::CLASSCONTENT_BASE_NAMESPACE, '', $classname);
    }
56111
public static function loadCustom($classname, $namespace, $name) {

		if(false === is_string($classname)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($classname)), E_USER_ERROR);
		}

		if(false === is_string($namespace)) {
			return trigger_error(sprintf('Argument 2 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($namespace)), E_USER_ERROR);
		}

		if(false === is_string($name)) {
			return trigger_error(sprintf('Argument 3 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($name)), E_USER_ERROR);
		}

		static :: $custom[$name] = $namespace;

		return static :: Instance();
	}
1340986
public static function patched($namespace, $className, $methodName, &$substitute = null)
    {
        $name = $className ?: $methodName;

        if ($namespace && ($className || function_exists("{$namespace}\\{$name}"))) {
            $name = "{$namespace}\\{$name}";
        }

        $method = isset(static::$_registered[$name]) ? static::$_registered[$name] : null;

        if (!$methodName) {
            $fake = $method ? $method->substitute() : null;
            if (is_object($fake)) {
                $substitute = $fake;
            }
            return $fake ?: $name;
        }

        if (!$method) {
            if (!Suite::registered($name)) {
                return $name;
            }
        } elseif ($method->actsAsAReplacement()) {
            return $method->closure();
        }

        return function () use ($name, $method) {
            $args = func_get_args();

            if (Suite::registered($name)) {
                Calls::log(null, compact('name', 'args'));
            }
            if ($method && $method->matchArgs($args)) {
                return $method($args);
            }
            return call_user_func_array($name, $args);
        };
    }
1323639
public function getClassNames ( $withNamespace = true ) {
        $tokens = new \PHP_Token_Stream($this->_content);
        $classes = $tokens->getClasses();
        $classNames = array();
        foreach ( $classes as $className => $class ) {
            $namespace = $class['package']['namespace'];
            if ( $withNamespace === true && $namespace !== '' ) {
                $className = $namespace . '\\' . $className;
            }
            $classNames[] = $className;
        }
        return $classNames;
    }