final public function create($type, array $args = null, callable $cb = null)
    {
        if (!is_string($type)) {
            throw new InvalidArgumentException(
                sprintf(
                    '%s: Type must be a string.',
                    get_called_class()
                )
            );
        }

        if (!isset($args)) {
            $args = $this->arguments();
        }

        $pool = get_called_class();
        if (isset($this->resolved[$pool][$type])) {
            $className = $this->resolved[$pool][$type];
        } else {
            if ($this->isResolvable($type) === false) {
                $defaultClass = $this->defaultClass();
                if ($defaultClass !== '') {
                    $obj = $this->createClass($defaultClass, $args);
                    $this->runCallbacks($obj, $cb);
                    return $obj;
                } else {
                    throw new InvalidArgumentException(
                        sprintf(
                            '%1$s: Type "%2$s" is not a valid type. (Using default class "%3$s")',
                            get_called_class(),
                            $type,
                            $defaultClass
                        )
                    );
                }
            }

            // Create the object from the type's class name.
            $className = $this->resolve($type);
            $this->resolved[$pool][$type] = $className;
        }

        $obj = $this->createClass($className, $args);

        // Ensure base class is respected, if set.
        $baseClass = $this->baseClass();
        if ($baseClass !== '' && !($obj instanceof $baseClass)) {
            throw new Exception(
                sprintf(
                    '%1$s: Class "%2$s" must be an instance of "%3$s"',
                    get_called_class(),
                    $className,
                    $baseClass
                )
            );
        }

        $this->runCallbacks($obj, $cb);

        return $obj;
    }