public function resolve(string $alias) : bool
    {
        // return false if alias already resolved.
        if (in_array($alias, $this->resolved)) {
            return false;
        }

        $this->resolved[] = $alias;

        // Resolve class alias if set.
        if ($this->has($alias)) {
            $class = $this->get($alias);
            $class = (class_exists($class, true)) ? $class : false;
        } else {
            // Resolve namespace alias.
            $class = $this->resolveNamespaceAlias($alias);
        }

        // Remove the resolved class
        array_pop($this->resolved);

        // If class exists create and return a alias of the class.
        return (!class_exists($class)) ? false : class_alias($class, $alias);
    }