lithium\core\Adaptable::adapter()

public static method

Returns adapter class name for given $name configuration, using the $_adapter path defined in Adaptable subclasses.

Parameters

  • string|null $name

    Class name of adapter to load.

Returns

object

Adapter object.

Source

	public static function adapter($name = null) {
		$config = static::_config($name);

		if ($config === null) {
			throw new ConfigException("Configuration `{$name}` has not been defined.");
		}

		if (isset($config['object'])) {
			return $config['object'];
		}
		$class = static::_class($config, static::$_adapters);
		$settings = static::$_configurations[$name];
		$settings[0]['object'] = static::_initAdapter($class, $config);
		static::$_configurations[$name] = $settings;
		return static::$_configurations[$name][0]['object'];
	}