public function getDriver($name = null)
    {
        $name = strtolower($name) ?: $this->defaultDriverName;

        if (null === $name) {
            throw new \InvalidArgumentException('Specify a Drupal driver to get.');
        }

        if (!isset($this->drivers[$name])) {
            throw new \InvalidArgumentException(sprintf('Driver "%s" is not registered', $name));
        }

        $driver = $this->drivers[$name];

        // Bootstrap driver if needed.
        if (!$driver->isBootstrapped()) {
            $driver->bootstrap();
        }

        return $driver;
    }
public function getDriver($name = null)
    {
        $name = strtolower($name) ?: $this->defaultDriverName;

        if (null === $name) {
            throw new \InvalidArgumentException('Specify a Drupal driver to get.');
        }

        if (!isset($this->drivers[$name])) {
            throw new \InvalidArgumentException(sprintf('Driver "%s" is not registered', $name));
        }

        $driver = $this->drivers[$name];

        // Bootstrap driver if needed.
        if (!$driver->isBootstrapped()) {
            $driver->bootstrap();
        }

        return $driver;
    }
public function getDriver ( $ name = null ) { $ name = strtolower ( $ name ) ? : $ this -> defaultDriverName ; if ( null === $ name ) { throw new \ InvalidArgumentException ( 'Specify a Drupal driver to get.' ) ; } if ( ! isset ( $ this -> drivers [ $ name ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Driver "%s" is not registered' , $ name ) ) ; } $ driver = $ this -> drivers [ $ name ] ; // Bootstrap driver if needed. if ( ! $ driver -> isBootstrapped ( ) ) { $ driver -> bootstrap ( ) ; } return $ driver ; }
Return a registered driver by name, or the default driver.

@param string $name
The name of the driver to return. If omitted the default driver is
returned.

@return \Drupal\Driver\DriverInterface
The requested driver.

@throws \InvalidArgumentException
Thrown when the requested driver is not registered.
Return a registered driver by name or the default driver .