public function addProvider($provider)
    {
        if (is_string($provider)) {
            $provider = new $provider($this);
        }

        // Only allow a service provider to be registered
        // once.
        if (in_array($provider, $this->providers)) {
            return;
        }

        $this->providers[] = $provider;

        $this->registerEvents($provider);
        $this->registerProvides($provider);

        $this->registerProvider($provider);
    }