获取已经注册驱动.

@param $driver 驱动吗

@return mixed
177315
protected function getFactory($driver) {
        $class = is_object($driver) ? get_class($driver) : $driver;
        foreach ($this->logger as $value) {
            if ($value instanceof $class) {
                return $value;
            }
        }
    }
960972
public function getDriver($alias)
    {
        try {
            if ($alias == "Auth") {
                $driver = \Auth::driver();
            } elseif ($alias == "DB") {
                $driver = \DB::connection();
            } elseif ($alias == "Cache") {
                $driver = get_class(\Cache::driver());
                $store = get_class(\Cache::getStore());
                return array($driver, $store);
            } elseif ($alias == "Queue") {
                $driver = \Queue::connection();
            } else {
                return false;
            }

            return get_class($driver);
        } catch (\Exception $e) {
            $this->error("Could not determine driver/connection for $alias.");
            return false;
        }
    }
666376
public function driver(string $driver): DriverInterface
    {
        if (isset($this->drivers[$driver])) {
            return $this->drivers[$driver];
        }
        try {
            return $this->drivers[$driver] = $this->config->getDriver($driver)->resolve($this->factory);
        } catch (ContainerExceptionInterface $e) {
            throw new DBALException($e->getMessage(), $e->getCode(), $e);
        }
    }
1144218
public function isDriverEnabled($driver)
    {
        $this->validateDriver($driver);

        $drivers = $this->getDriversFromStorage();

        return isset($drivers[$driver]);
    }
365770
public function roles($driver = null)
	{
		$result = array();

		if ($driver === null)
		{
			foreach (\Auth::acl(true) as $acl)
			{
				method_exists($acl, 'roles') and $result = \Arr::merge($result, $acl->roles());
			}
		}
		else
		{
			$result = \Auth::acl($driver)->roles();
		}

		return $result;
	}
1017929
public function getPurger($driver, $manager)
    {
        if (isset($this->purgerCache[$hash = sha1($driver.'.'.$manager)])) {
            return $this->purgerCache[$hash];
        }

        $manager = $this->getService($manager);

        return $this->purgerCache[$hash] = $driver === ResourceInterface::DRIVER_DOCTRINE_MONGODB
            ? new MongoDBPurger($manager)
            : new ORMPurger($manager);
    }
60426
public function groups($driver = null)
	{
		$result = array();

		if ($driver === null)
		{
			foreach (\Auth::group(true) as $group)
			{
				method_exists($group, 'groups') and $result = \Arr::merge($result, $group->groups());
			}
		}
		else
		{
			$result = \Auth::group($driver)->groups();
		}

		return $result;
	}
245336
public function getDriver() : Driver
    {
        if (is_null($this->driver)) {
            $this->driver = $this->driverFactory->createDriver();
            $this->driver->connect();
        }

        return $this->driver;
    }
229483
public function is_supported($driver)
	{
		static $support;

		if ( ! isset($support, $support[$driver]))
		{
			$support[$driver] = $this->{$driver}->is_supported();
		}

		return $support[$driver];
	}
1047142
public function getService($driver)
    {
        $parts = $driver = explode(':', $driver);
        $driver = explode('.', $parts[0]);

        if (isset($driver[1])) {
            $serviceName = $driver[0].'.'.$driver[1].'_bundle.manager.'.$driver[1].'_manager';
            if ($this->container->has($serviceName)) {
                return $this->container->get($serviceName);
            }
        }
    }
1268714
public function getAdapter(string $driver, string $connection = null)
    {
        if (array_key_exists($driver, $this->drivers)) {
            return $this->drivers[$driver]->getAdapter($connection);
        }
    }
951047
protected function getExporter($driver)
    {
        if (!array_key_exists($driver, static::$drivers)) {
            return $this->getDefaultExporter();
        }

        return new static::$drivers[$driver]($this->grid);
    }
691544
protected function getConnector($driver)
    {
        if (isset($this->connectors[$driver]))
        {
            return call_user_func($this->connectors[$driver]);
        }

        throw new \InvalidArgumentException("No connector for [$driver]");
    }
1108004
private static function isValidDriver(string $driver): bool
    {
        return
            class_exists($driver) &&
            Arr::contains(class_implements($driver), StorageInterface::class);
    }
263804
public function register($driver, $key) {
        #获取驱动已经注册过时直接返回
        if (isset($this->logger[$key])) {
            return $this->logger[$key];
        }
        #如果是字符串则重新注册
        if (is_string($driver)) {
            $driver = new $driver($this);
        }
        $driver->register($this);
        #记录驱动
        $this->logger[$key] = $driver;
    }
660887
protected function validateDriver($driver)
    {
        $interface = $this->interface();

        if (! (new ReflectionClass($driver))->implementsInterface($interface)) {
            throw new InvalidDriverException(get_class($driver)." does not implement {$interface}");
        }

        return $driver;
    }
851198
public function driver()
    {
        $args = func_get_args();
        $props = Driver::parseArgs($args);
        $newProps = $this->callHookHandler('beforeCreateDriver', $props);
        if (is_array($newProps)) {
            $props = array_merge($props, $newProps);
        }
        extract($props);
        $driver = Driver::create($this, $name, $weight, $backup, $work);
        $this->drivers[$name] = $driver;
        $this->callHookHandler('afterCreateDriver', $driver);

        return $driver;
    }