Manipulation::loadDriver

Internal driver loader.

@param string $driverOffset Driver offset name.

@return bool
174385
protected function loadDriver($driverOffset)
    {
        $driverClassName = '\O2System\Image\Drivers\\' . ucfirst($driverOffset) . 'Driver';

        if (class_exists($driverClassName)) {
            if ($this->config->offsetExists($driverOffset)) {
                $config = $this->config[ $driverOffset ];
            } else {
                $config = $this->config->getArrayCopy();
            }

            if (isset($config[ 'engine' ])) {
                unset($config[ 'engine' ]);
            }

            $this->driver = new $driverClassName();

            return true;
        }

        return false;
    }
445313
public function flick($xOffset, $yOffset, $speed = WebDriver::SPEED_NORMAL)
    {
        $command = $this->webDriver->getDriver()->factoryCommand(
            'touch/flick',
            WebDriver_Command::METHOD_POST,
            [
                'element' => $this->element->getElementId(),
                'xoffset' => (int) $xOffset,
                'yoffset' => (int) $yOffset,
                'speed' => (int) $speed,
            ]
        );
        $this->webDriver->getDriver()->curl($command);
        return $this;
    }
508195
public function driver($driverName)
    {
        $shortener = new UrlShortener($this->driverFactory);
        $shortener->setDriver($driverName);
        return $shortener;
    }
490461
public function loadDrivers(): DriverCollection
    {
        $drivers = new DriverCollection($this);

        foreach ($this->drivers as $name => $driver) {
            $drivers->add($name, $driver);
        }

        return $drivers;
    }
1083781
public function isSupported($driver)
    {
        static $support;

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

        return $support[$driver];
    }
558745
private function findDriver($driver = '')
    {
        if (isset($this->driverList[$driver])) {
            $driver = $this->driverList[$driver];
        } else {
            throw new DriverNotFoundException(sprintf('%s adında bir sürücü bulunamadı', $driver));
        }

        if (is_string($driver)) {
            $callableName = "create" . ucfirst($driver) . "Driver";
            $response = call_user_func([$this, $callableName]);
        } elseif (is_callable($driver)) {
            $response = $driver();
        }

        return $response;
    }
1093840
public function getBufferLength($atOffset = false)
    {
        if ($atOffset === false) {
            return $this->bufferLength;
        }

        return $this->bufferLength - $this->offset;
    }
209125
public function setCacheDriver($cacheDriver = '')
    {
        if ($cacheDriver != self::DEFAULT_DRIVERS && (extension_loaded($cacheDriver))) {
            $this->cacheDriver = $cacheDriver;
            $this->debug->debug(__FUNCTION__, 'Set Cache Driver: ' . json_encode($cacheDriver) . ' and server is supported');
        } else {
            $this->debug->error(__FUNCTION__, 'Set Cache Driver: ' . json_encode($cacheDriver) . ' and server is not supported, user default driver: ' . self::DEFAULT_DRIVERS);
            $this->cacheDriver = self::DEFAULT_DRIVERS;
        }
        $this->debug->debug(__FUNCTION__, 'setCacheDriver: ', $this->cacheDriver);
    }
1077554
public function check($driver)
    {
        switch ($driver) {
            case self::DRIVER_MEMCACHE:
                return extension_loaded('memcache');
            case self::DRIVER_MEMCACHED:
                return extension_loaded('memcached');
        }
        return false;
    }
62734
private function nextDriver($driverName)
    {
        $driverOrder = config('cache_fallback.fallback_order');
        if (in_array($driverName, $driverOrder, true) && last($driverOrder) !== $driverName) {
            $nextKey = array_search($driverName, $driverOrder, true) + 1;
            return $driverOrder[$nextKey];
        }
        return null;
    }
531730
protected function _getMinkDriver($sDriver)
    {
        $browserName = $this->getTestConfig()->getBrowserName();
        switch ($sDriver) {
            case 'selenium':
                $client = $this->_getClient();
                $oDriver = new \Behat\Mink\Driver\SeleniumDriver($browserName, shopURL, $client);
                break;
            default:
                throw new Exception('Driver ' . $sDriver . ' not supported any more!');
                break;
        }

        return $oDriver;
    }
454139
protected function createDriver($driver, array $settings = [], $resolve = true)
    {
        $class = $this->getNamespace() . '\\' . studly_case($driver) . $this->getClassSuffix();

        // 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, $settings);
        } elseif (class_exists($class)) {
            $instance = $this->container->make($class);

            if ($resolve) {
                return $instance->resolve($settings);
            }

            return $instance;
        }

        throw new DriverNotFound("Driver [$driver] not supported.");
    }
1361621
private function createDriver(array $config)
	{
		if (empty($config['driver'])) {
			throw new InvalidStateException('Undefined driver');
		} elseif ($config['driver'] instanceof IDriver) {
			return $config['driver'];
		} else {
			$name = ucfirst($config['driver']);
			$class = "Mva\\Dbm\\Driver\\{$name}\\{$name}Driver";
			return new $class;
		}
	}
858361
private static void loadDriver(String classname) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
		if(!driversLoaded.containsKey(classname)) {
			Object O = Class.forName(classname).newInstance();
			driversLoaded.putIfAbsent(classname, O);
		}
	}
874928
public function setOffset($offset)
    {
        $this->offset = $offset === null ? null : (int) $offset;
        return $this;
    }
677520
public function load(string $driverName) : IAnalyticsDriver
    {
        if (!isset(self::$drivers[$driverName])) {
            throw InvalidArgumentException::format(
                'Invalid driver name supplied to %s: expecting one of (%s), \'%s\' given',
                __METHOD__, Debug::formatValues(array_keys(self::$drivers)), $driverName
            );
        }

        if (!isset($this->driversCache[$driverName])) {
            $this->driversCache[$driverName] = $this->iocContainer->get(self::$drivers[$driverName]);
        }

        return $this->driversCache[$driverName];
    }
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;
        }
    }