获取邮件驱动

@param mixed $driver 发送邮件驱动名称

@return object
@throws Exception
344208
public function getDriver($driver = null)
    {
        $driverName = $driver ? $driver : Config::get('driver');
        if (is_array($driverName)) {
            // 驱动为数组，表示类的某个方法
            if (!is_callable($driverName)) {
                throw new BadMethodCallException('Method Not Found: ' . $driverName[0] . '->' . $driverName[1] . '()');
            }

            return call_user_func_array($driverName, []);
        } elseif (is_object($driverName)) {
            // 驱动为对象直接返回
            return $driverName;
        } elseif (is_string($driverName)) {
            // 驱动为字符串，为内置驱动
            $driver = 'create' . ucfirst($driverName) . 'Driver';
            if (!method_exists($this, $driver)) {
                throw new BadMethodCallException("Mailer driver {$driverName} not exist");
            }
        }


        return $this->$driver();
    }
947708
public static function createInstance($driver, $options)
    {
        if(!in_array($driver, self::$_validDrivers)) {
            throw new \Exception("Driver '{$driver}' not implemented");
        }

        $class = __NAMESPACE__ . '\\Driver\\' . $driver;

        $driver = new $class;
        $driver->setOptions($options);

        return new Storage($driver);
    }
611454
public static function unloadDriver($driver)
    {
        foreach (array_keys(self::$drivers, $driver) as $key) {
            unset(self::$drivers[$key]);
        }
    }
1310624
public function driver( $driver )
	{
		$driver = CCCORE_NAMESPACE.'\\'.'CCConfig_'.ucfirst( $driver );
		
		if ( !class_exists( $driver ) ) 
		{
			throw new \InvalidArgumentException("CCConfig - Invalid driver '".$driver."'");
		}
		
		$this->_driver = new $driver;
	}
1342021
public function driver($driver)
    {
        $this->container['sms.sender'] = $this->container->share(function ($app) use ($driver) {
            return (new DriverManager($app))->driver($driver);
        });

        $this->driver = $this->container['sms.sender'];
    }
1118781
public function getQueryAdapter($driver) {
		if (!isset($this->queryAdapters[$driver])) {
			$this->queryAdapters[$driver] = $this->createQueryAdapter($driver);
		}
		return $this->queryAdapters[$driver];
	}
1342748
public static function setDriver($driver)
        {
            if (self::isDriverSupported($driver) == false) {
                throw new Exception('The selected database is not supported: "' . $driver . '".');
            }
            self::$driver = $driver;
        }
217840
protected function setDriver($driver){
		if(strcasecmp($driver, 'sqlite') === 0) // Backward compatibility
			$driver = 'SQLite2';

		$class = "Neevo\\Drivers\\{$driver}Driver";

		if(!class_exists($class)){
			$file = __DIR__ . '/Drivers/' . strtolower($driver) . '.php';
			if(!file_exists($file))
				throw new DriverException("$driver driver file ($file) does not exist.");
			if(is_readable($file))
				include_once $file;
			else
				throw new DriverException("$driver driver file ($file) is not readable.");
		}
		if(!$this->isDriver($class))
			throw new DriverException("Class '$class' is not a valid Neevo driver class.");

		$this->driver = new $class;

		// Set statement parser
		if($this->isParser($class))
			$this->parser = $class;
	}
591208
protected function createDriver($driver)
	{
		$method = 'create'.ucfirst($driver).'Driver';

		// We'll check to see if a creator method exists for the given driver. If not we
		// will check for a custom driver creator, which allows developers to create
		// drivers using their own customized driver creator Closure to create it.
		if (isset($this->customCreators[$driver]))
		{
			return $this->callCustomCreator($driver);
		}
		elseif (method_exists($this, $method))
		{
			return $this->$method();
		}

		throw new \InvalidArgumentException("Driver [$driver] not supported.");
	}
852555
public function setDriver($driver) {

    	if(false === is_string($driver)) {
    		return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($driver)), E_USER_ERROR);
    	}

        if(false === class_exists($driver)) {

            $driver = __NAMESPACE__ . '\\Driver\\' . $driver;
        
            if(false === class_exists($driver)) {
        		return trigger_error(sprintf('Driver "%s" does not exists', $driver), E_USER_ERROR);
        	}
        }

        $this -> driver = $driver;

        return $this;
    }
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);
            }
        }
    }
15403
public function getView(Driver $driver)
    {
        $this->dataExporter->setModelClass($this->modelClass);
        $this->view->setParam('menu', $this->container->getParameter('symfonyid.admin.menu.menu_name'));
        $this->view->setParam('action_method', $this->translator->trans('page.list', array(), $this->container->getParameter('symfonyid.admin.translation_domain')));
        $this->view->setParam('allow_create', $this->allowCreate);
        $this->view->setParam('allow_delete', $this->allowBulkDelete);
        $this->view->setParam('allow_download', $this->dataExporter->isAllowExport($driver, $this->container->getParameter('symfonyid.admin.max_records')));
        $this->view->setParam('number', $this->container->getParameter('symfonyid.admin.number'));
        $this->view->setParam('formating_number', $this->formatNumber);

        $this->setHeader();
        $this->setRecords($driver);

        return $this->view;
    }
1101632
public function getExceptionAdapter($driver) {
		if (!isset($this->exceptionAdapters[$driver])) {
			$this->exceptionAdapters[$driver] = $this->createExceptionAdapter(
				$driver);
		}
		return $this->exceptionAdapters[$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;
    }
950802
public function driver($driver = '', array $configs = [])
    {
        $driverList = $this->getDriverList();

        if (!count($configs)) {
            $configs = isset($this->getConfig()[$driver]) ? $this->getConfig()[$driver] : [];
        }

        if (isset($driverList[$driver])) {
            $driver = $driverList[$driver];
        }

        if (is_string($driver)) {
            $driver = new $driver;
        }

        return $this->setDriver($driver, $configs);
    }
167304
private function getDriver(): \BearFramework\App\IDataDriver
    {
        if ($this->driver !== null) {
            return $this->driver;
        }
        throw new \Exception('No data driver specified! Use useFileDriver() or setDriver() to specify one.');
    }
1246780
static function loadDriver($driver_name, $params = NULL) {
        $driver_class = '\\Hiano\\Driver\\' . $driver_name;
        if (!class_exists($driver_class)) {
                throw new \Exception('无法装载驱动，驱动文件不存在！');
        }
        if ($params) {
            return new $driver_class($params);
        } else {
            return new $driver_class;
        }
    }