public function attach($name, $resolver = null, $single = false, $override = false)
    {
        if (is_array($name)) {
            $resolver  = current($name);
            $name  = key($name);
            $this->alias($resolver, $name, $override);
        }

        if ($name instanceof Asset) {
            $this->setParam('assets', $name->is(), $name, $override);
        } elseif ($resolver instanceof \Closure && $single) {
            $this->setParam('assets', $name, function($params) use ($resolver) {
                static $obj;

                if ($obj === null) {
                    $obj = $resolver($params, $this);
                }
                return $obj;
            }, $override);

        } elseif ($resolver instanceof \Closure || $resolver instanceof Asset) {
            $this->setParam('assets', $name, $resolver, $override);

        } elseif (is_object($resolver)) {
            $this->setParam('instances', $name, $resolver, $override);

        } elseif (($resolver === null) && $single) {
            $this->setParam('instances', $name, $name, $override);

        } elseif ($single) {
            $this->setParam('instances', $name, $resolver, $override);

        } elseif ($resolver === null) {
            $this->setParam('assets', $name, $name, $override);
        }

        // If we have a singleton, make sure it is only in
        // the *instances* array and not within *aliases*.
        if ($single && isset($this->aliases[$name])) {
            unset($this->aliases[$name]);
        }

        return $this;
    }