Returns a class name with namespaces removed.

@param string $className

@return string
16240
public function getRelativeClass($className)
    {
        if (strpos($className, '\\') !== false) {
            $className = substr($className, strrpos($className, '\\') + 1);
        }

        return $className;
    }
242222
public static function getCarrierShortName($className)
    {
        if (0 === strpos($className, '\\')) {
            $className = substr($className, 1);
        }

        if (0 === strpos($className, 'Omniship\\')) {
            return trim(str_replace('\\', '_', substr($className, 8, -7)), '_');
        }

        return '\\'.$className;
    }
1011232
protected static function getClassName($className) {
		if (class_exists($className)) {
			while (class_exists('ux_' . $className, FALSE)) {
				$className = 'ux_' . $className;
			}
		}

		return $className;
	}
458489
public function fullyQualifiedName($class)
    {
        if ($this->namespace) {
            $namespace = str_replace('\\\\', '\\', '\\' . $this->namespace . '\\');
        } else {
            $namespace = '\\'; // global namespace
        }

        if ($this->class === null) {
            $this->class = '';
        }

        if ($class === null) {
            return '';
        }

        if (strcasecmp($class, $this->class) === 0) {
            return $namespace . $this->class;
        }
        $pos = strpos($class, '\\');
        if ($pos !== false) {
            if ($pos === 0) {
                // Fully qualified name (\Foo\Bar)
                return $class;
            }
            // Qualified name (Foo\Bar)
            if ($this->uses) {
                foreach ($this->uses as $alias => $aliasedNamespace) {
                    $alias .= '\\';
                    if (strcasecmp(substr($class, 0, strlen($alias)), $alias) === 0) {
                        // Aliased namespace (use \Long\Namespace as Foo)
                        return '\\' . $aliasedNamespace . substr($class, strlen($alias) - 1);
                    }
                }
            }
        } elseif ($this->uses) {
            // Unqualified name (Foo)
            foreach ($this->uses as $alias => $aliasedNamespace) {
                if (strcasecmp($alias, $class) === 0) {
                    return '\\' . $aliasedNamespace;
                }
            }
        }

        return $namespace . $class;
    }
660627
public function getClassName(string $name) : string
    {
        $name = str_replace("/", "\\", $name);
        $name = explode("\\", $name);
        $name = array_pop($name);
        $name = $this->removeNoneAlpherNumeric($name);
        return $name;
    }
1113030
public function loadClass($className)
    {
        $found = false;
        $nsSep = $this->namespace.$this->namespaceSeparator;
        if (null === $this->namespace || $nsSep === substr($className, 0, strlen($nsSep))) {
            $fileName = '';
            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);
                $fileName .= DIRECTORY_SEPARATOR;
            }
            $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . $this->fileExtension;
            $filePath  = stream_resolve_include_path($this->includePath . DIRECTORY_SEPARATOR . $fileName);
            if ($filePath) {
                /** @noinspection PhpIncludeInspection */
                require $filePath;
                $found = true;
            }
        }
        return $found;
    }
560969
protected function getNamespaceFromClassname($class_name)
    {
        $parts = collect(explode('\\', trim($class_name, '\\')));
        $parts->pop();
        return '\\' . $parts->implode('\\');
    }
818557
public static function getNameFromNs($className, $namespace)
    {
        $className = static::getFormatNamespace($className, true, true);
        $namespace = static::getFormatNamespace($namespace, true, true);
        if (StringHelper::startsWith($className, $namespace)) {
            $className = substr($className, strlen($namespace));
        }

        return trim($className, '\\');
    }
152619
public static function fromString($className)
    {
        $atoms = explode(static::NAMESPACE_SEPARATOR, $className);
        $isAbsolute = false;
        if ('' === $atoms[0]) {
            $isAbsolute = true;
            array_shift($atoms);
        }

        return static::fromAtoms($atoms, $isAbsolute);
    }
323859
public function resolve(ClassName $className)
    {
        if ($className->isAbsolute()) {
            return $className;
        } elseif ($className->isShortName()) {
            $usedClass = $this->usedClass($className);
            if (null !== $usedClass) {
                return $usedClass;
            }
        }

        if (null !== $this->namespaceName()) {
            return $this->namespaceName()->join($className);
        }

        return $className->toAbsolute();
    }
779223
public static function mapClassNameToFileName($className)
    {
        $arr = preg_split('/(?=[A-Z])/', $className);
        unset($arr[0]); // remove the first element ('')
        $fileName = static::getCurrentTimestamp() . '_' . strtolower(implode($arr, '_')) . '.php';

        return $fileName;
    }
150358
public function classToTableName($className)
    {
        $className = $this->getRelativeClass($className);
        $className = ltrim(strtolower(preg_replace('/[A-Z]/', '_$0', $className)), '_');

        return $this->prefix . $className;
    }
1035555
public function shorten(ClassName $className)
    {
        if (!$className->isAbsolute()) {
            return $className;
        }

        foreach ($this->usedClasses() as $tuple) {
            list($usedClass, $as) = $tuple;
            if ($this->comparator()->equals($usedClass, $className)) {
                return $as;
            }
        }

        if (
            null !== $this->namespaceName() &&
            $this->namespaceName()->hasDescendant($className)
        ) {
            return $className->stripNamespace($this->namespaceName());
        }

        return $className;
    }
88978
public function filterNamespace( $namespaceName) {
        $FilteredClasses = [];
        foreach( $this->loadedClasses as $loadedClass){
            if( 0 == substr_compare( $loadedClass, $namespaceName, 0, strlen( $namespaceName))){
                $FilteredClasses[] = $loadedClass;
            }
        }
        $this->loadedClasses = $FilteredClasses;
    }
509790
public static function classExists($className, $namespace)
    {
        if (class_exists($className)) {
            return $className;
        }

        // add namespace
        $className = sprintf('%s%s', static::getFormatNamespace($namespace, true), $className);

        if (class_exists($className)) {
            return $className;
        }

        return false;
    }
205180
public function getFacadeShortName($className)
        {
            if (0 === strpos($className, '\\')) {
                $className = substr($className, 1);
            }

            if (0 === strpos($className, 'UniApi\\')) {
                return trim(str_replace('\\', '_', substr($className, 8, -7)), '_');
            }

            return '\\'.$className;
        }
1102370
protected function _completeClassName($name, $className)
    {
        if (isset($this->_definitions[$name])) {
            $definition = $this->_definitions[$name];
        } else {
            return $className;
        }

        if (is_string($definition)) {
            if ($pos = strrpos($definition, '\\')) {
                return substr($definition, 0, $pos + 1) . ucfirst($className);
            } else {
                return $className;
            }
        } elseif (is_array($definition) && isset($definition['class'])) {
            if ($pos = strrpos($definition['class'], '\\')) {
                return substr($definition['class'], 0, $pos + 1) . ucfirst($className);
            } else {
                return $className;
            }
        } else {
            return $className;
        }
    }