Returns a formatted HTML span showing the given class name without the namespace part, but it also including the
namespace via a tooltip.

@param string $name
@return string
777386
static function formatClassName ($name)
  {
    $n = explode ('\\', $name);
    $c = array_pop ($n);
    return sprintf ("<span class='__type hint--rounded hint--top' data-hint='%s'>%s</span>", $name, $c);
  }
1337211
public static function get($name)
    {
        $namespaces = config('crude.namespace');

        if (! is_array($namespaces)) {
            $fullName = $namespaces . $name;

            return class_exists($fullName)
                ? new $fullName()
                : null;
        }

        foreach ($namespaces as $namespace) {
            $fullName = $namespace . $name;
            if (class_exists($fullName))
                return new $fullName();
        }

        return null;
    }
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, '\\');
    }
1341994
public function instance($name)
    {
        // If the class name starts with a dot, then find the class in the same class path as the caller
        if(substr($name, 0, 1) == '.')
        {
            $name = $this->getJaxonClassPath() . $name;
        }
        // The class namespace is prepended to the class name
        elseif(substr($name, 0, 1) == ':' && ($namespace = $this->getJaxonNamespace()))
        {
            $name = str_replace('\\', '.', trim($namespace, '\\')) . '.' . substr($name, 1);
        }
        return jaxon()->sentry()->instance($name);
    }
747641
public function getElement($name) {
		if (isset($this->elements[$name])) {
			return $this->elements[$name];
		}
		
		$class = 'ZExt\Mvc\View\Helpers\Head\Element' . ucfirst($name);
		
		$element = new $class(
			$this->getBaseStaticPath(),
			$this->getBaseStaticUrl(),
			$this->getMetadataManager()
		);

		if ($this->isStaticHashAppend() && method_exists($element, 'setHashAppend')) {
			$element->setHashAppend();
		}

		$this->elements[$name] = $element;
		return $element;
	}
1124173
protected function getSectionClassName(string $name) : string {
        $className = sprintf(
            '%s\\%s',
            get_class($this),
            ucfirst($name)
        );

        if (! class_exists($className)) {
            throw new \RuntimeException(
                sprintf(
                    'Invalid section name "%s" (%s)',
                    $name,
                    $className
                )
            );
        }

        return $className;
    }
233717
public function classFilename(string $element, string $name): string
    {
        $namespace = $this->classNamespace($element, $name);
        $namespace = substr($namespace, strlen($this->baseNamespace()));

        $directory = $this->baseDirectory() . '/' . str_replace('\\', '/', $namespace);

        return rtrim($directory, '/') . '/' . $this->className($element, $name) . '.php';
    }
1179611
public static function & GetNamespace (
		$name = \MvcCore\ISession::DEFAULT_NAMESPACE_NAME
	) {
		if (!static::GetStarted()) static::Start();
		if (!isset(static::$instances[$name])) {
			static::$instances[$name] = new static($name);
		}
		/** @var $result \MvcCore\Session */
		$result = & static::$instances[$name];
		return $result;
	}
497406
public function getNamespaceByName( $name ) {
		$result = $this->getNamespaceResult()['query'];
		foreach ( $result['namespaces'] as $nsInfo ) {
			if ( ( !empty( $nsInfo['canonical'] ) && $nsInfo['canonical'] === $name ) ||
				$nsInfo['*'] === $name ) {
				return $this->createNamespaceFromQuery( $nsInfo, $result['namespacealiases'] );
			}
		}
		foreach ( $result['namespacealiases'] as $alias ) {
			if ( $alias['*'] === $name && !empty( $result['namespaces'][$alias['id']] ) ) {
				return $this->createNamespaceFromQuery(
					$result['namespaces'][$alias['id']],
					$result['namespacealiases']
				);
			}
		}
		return null;
	}
567557
public function getHtml(string $name)
    {
        return $this->htmlContentAreas->where(function (HtmlContentArea $contentArea) use ($name) {
            return $contentArea->name === $name;
        })->first();
    }
523734
protected function element(string $name): \DOMElement
    {
        if (\strpos($name, ':') !== false)
        {
            $keys = explode(':', $name);

            return $this->document()->createElementNS(
                $this->namespaces[$this->options()->getNamespace() . ':' . \current($keys)],
                $name
            );
        }

        return $this->createElement($name);
    }
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;
        }
    }
348170
public function getFormat($name)
    {
        if (empty($this->formats[$name]) || !($this->formats[$name] instanceof FormatInterface)) {
            $class = sprintf('Windwalker\\Language\\Format\\%sFormat', $name);

            if (!class_exists($class)) {
                throw new \DomainException('Format ' . $name . ' not support. Class: ' . $class . ' not found');
            }

            $this->formats[$name] = new $class();
        }

        return $this->formats[$name];
    }
68766
protected function getHtmlName($name)
    {
        if (strpos($name, '.')) {
            $segments = explode('.', $name);
            return array_shift($segments).'['.implode('][', $segments).']';
        }

        return $name;
    }
433270
private function getTypeName($name)
    {
        if (!$name) {
            return null;
        }

        if (is_string($name)) {
            return $name;
        }

        $prefix = '';
        if ($name instanceof NullableType) {
            $name   = $name->type;
            $prefix = '?';
        }

        return $prefix . $this->getFullClassName($name);
    }
1349157
protected function getNamespaceSegments($name)
    {
        $segments = explode(static::HINT_PATH_DELIMITER, $name);

        if (count($segments) != 2) {
            throw new \InvalidArgumentException("View [$name] has an invalid name.");
        }

        if ( ! isset($this->hints[$segments[0]])) {
            throw new \InvalidArgumentException("No hint path defined for [{$segments[0]}].");
        }

        return $segments;
    }
605434
protected function getSessionNamespace($name = null) {
		if ($name === null) {
			$name = str_replace('\\', '_', get_class($this));
		}
		
		if (isset($this->_namespacesInstances[$name])) {
			return $this->_namespacesInstances[$name];
		}
		
		$namespace = $this->getNamespaceFactory()->createNamespace($name);
		
		$this->_namespacesInstances[$name] = $namespace;
		return $namespace;
	}