@param  string|null   $namespace
@param  array<string> $aliased_classes
@param  string|null   $this_class
@param  int           $php_major_version
@param  int           $php_minor_version

@return null|string
2725
public function toPhpString(
        $namespace,
        array $aliased_classes,
        $this_class,
        $php_major_version,
        $php_minor_version
    ) {
        return $php_major_version >= 7 && $php_minor_version >= 1 ? $this->getKey() : null;
    }
1263210
public static function qualifiedClassName($className, $namespace)
    {
        if (empty($className)) {
            throw new \InvalidArgumentException('Class name cannot be empty.');
        }

        if (empty($namespace)) {
            throw new \InvalidArgumentException('Current namespace cannot be empty.');
        }

        $className = trim($className, '\\');
        $len = strlen($namespace);

        if (strlen($className) > $len && ($namespace . '\\') === substr($className, 0, $len + 1)) {
            return substr($className, $len + 1);
        }

        return $className;
    }
1098343
public function load($alias)
    {
        if (isset($this->aliases[$alias])) {
            return class_alias($this->aliases[$alias], $alias);
        }
        return null;
    }
843403
protected function findClassMappingInDirectory($OClass, $directory, $namespace)
    {
        $finder = new Finder();

        if (isset($this->classMap[$OClass])) {
            return $this->classMap[$OClass];
        }

        foreach ($finder->files()->name('*.php')->in($directory) as $file) {
            $class = $this->getClassByPath($file, $namespace);

            if (class_exists($class)) {
                $annotation = $this->getClassAnnotation($class);

                if ($annotation && $annotation->hasMatchingClass($OClass)) {
                    $this->classMap[$OClass] = $class;
                    return $class;
                }
            }
        }

        return null;
    }
1227589
public function renderClass($name = null, $namespace = null)
    {
        if ($namespace === null) {
            $namespace = $this->renderProperty('google', 'maps');
        }

        if (empty($namespace)) {
            return $name;
        }

        return $this->renderProperty($namespace, $name);
    }
59076
public function render($namespace = null)
    {
        $messagesToPrint = '';

        // get messages from each namespace.
        if (null === $namespace) {
            foreach ($this->classMessages as $namespace => $class) {
                $messagesToPrint .= $this->fetchMessagesFromNamespace($namespace);
            }
        } else {
            $messagesToPrint .= $this->fetchMessagesFromNamespace($namespace);
        }

        return $messagesToPrint;
    }
291787
public function toNamespacedString($namespace, array $aliased_classes, $this_class, $use_phpdoc_format)
    {
        $intersection_types = $this->getNamespacedIntersectionTypes(
            $namespace,
            $aliased_classes,
            $this_class,
            $use_phpdoc_format
        );

        if ($this->value === 'static') {
            return 'static';
        }

        if ($this->value === $this_class) {
            return 'self' . $intersection_types;
        }

        if ($namespace && stripos($this->value, $namespace . '\\') === 0) {
            return preg_replace(
                '/^' . preg_quote($namespace . '\\') . '/i',
                '',
                $this->value
            ) . $intersection_types;
        }

        if (!$namespace && stripos($this->value, '\\') === false) {
            return $this->value . $intersection_types;
        }

        if (isset($aliased_classes[strtolower($this->value)])) {
            return $aliased_classes[strtolower($this->value)] . $intersection_types;
        }

        return '\\' . $this->value . $intersection_types;
    }
1080149
public static function validateClass($name, $namespace = null)
    {
        $name = self::validateNamingConvention($name);

        $prefix = !empty($namespace) ? $namespace . '\\' : '';

        $name = self::validateUnique($name, function ($name) use ($prefix) {
                // Use reflection to get access to private isKeyword method.
                // @todo Remove this when we stop supporting PHP 5.3.
                $isKeywordMethod = new \ReflectionMethod(__CLASS__, 'isKeyword');
                $isKeywordMethod->setAccessible(true);
                $isKeyword = $isKeywordMethod->invoke(null, $name);
             return !$isKeyword &&
                !interface_exists($prefix . $name) &&
                !class_exists($prefix . $name);
        }, self::NAME_SUFFIX);

        return $name;
    }
138774
public function getValue($name, $namespace = self::DEFAULT_NAMESPACE)
    {
        return isset($this->values[$namespace][$name]) ? $this->values[$namespace][$name] : null;
    }
1222151
public function getAlert($namespace)
    {

        $messagesToPrint = $this->getView()->plugin('flash_messenger')->render($namespace);

        if (empty($messagesToPrint)) {
            return null;
        }

        $alert = $this->getView()->plugin('sxb_alert')->__invoke($messagesToPrint);

        if (in_array($namespace, $this->availableNamespaces)) {

            if (PluginFlashMessenger::NAMESPACE_DEFAULT === $namespace) {
                $namespace = PluginFlashMessenger::NAMESPACE_INFO;
            }

            $alert->$namespace();
        }

        if ($this->isBlock) {
            $alert->block();
        }

        return $alert;
    }
917747
private static function classBelongsToNamespace($className, $namespaces)
    {
        $belongsToNamespace = false;
        $check = array_values($namespaces);
        $lcClassName = strtolower(ltrim($className, '\\'));

        foreach ($check as $namespace) {
            if (false !== strpos($lcClassName, strtolower($namespace))) {
                $belongsToNamespace = true;
                continue;
            }
        }
        return $belongsToNamespace;
    }
45313
public function resolveNamespaceAlias($alias)
	{
		foreach ($this->namespaces as $namespace)
		{
			list($from, $to) = $namespace;

			if ($empty = empty($to) or strpos($alias, $to) === 0)
			{
				if ( ! $empty)
				{
					$alias = substr($alias, strlen($to) + 1);
				}

				$class = $from.'\\'.$alias;
				$this->resolving[] = $class;

				if ($this->objectExists($class, true))
				{
					array_pop($this->resolving);

					return $class;
				}
			}
		}

		return false;
	}
1351111
public function getInstance($alias = null)
    {
        if (!$alias && !$this->mainAlias) {
            $namespace = explode('\\', $this->_entityName);
            $alias = strtolower(end($namespace));
            $this->mainAlias = $alias;
        } elseif ($alias) {
            $this->mainAlias = $alias;
        }

        return $this->qb ? $this->qb : $this->qb = $this->createQueryBuilder($this->mainAlias);
    }
562626
public function toPhpString(
        $namespace,
        array $aliased_classes,
        $this_class,
        $php_major_version,
        $php_minor_version
    ) {
        if ($this instanceof TNamedObject) {
            return parent::toNamespacedString($namespace, $aliased_classes, $this_class, true);
        }

        return $this->value;
    }
950406
public function get_namespace($name = null)
    {
        $ns = $this->namespace;

        if ($name) {
            // an alias for BC
            if ($name == 'prefix') {
                $name = 'prefix_in';
            }

            return isset($ns[$name]) ? $ns[$name] : null;
        }

        unset($ns['prefix_in'], $ns['prefix_out']);

        return $ns;
    }
1223632
public function setNamespaceAliases(array $namespace_aliases)
    {
        $this->namespace_aliases = array();
        foreach ($namespace_aliases as $alias => $fqnn) {
            $this->setNamespaceAlias($alias, $fqnn);
        }
        return $this;
    }
722336
public static function get(string $namespace, string $name = null)
    {
        $name = $name ?: 'default';

        if (isset(self::$container[$namespace][$name])) {
            return self::$container[$namespace][$name];
        }

        return null;
    }