Extends
lithium\core\StaticObject
Obtain an `SplDoublyLinkedList` of the strategies for the given `$name` configuration, using
the `$_strategies` path defined in `Adaptable` subclasses.
Parameters
- string $name Class name of adapter to load.
Returns
object `SplDoublyLinkedList` of strategies, or `null` if none are defined.Source
public static function strategies($name) {
$config = static::_config($name);
if ($config === null) {
throw new ConfigException("Configuration `{$name}` has not been defined.");
}
if (!isset($config['strategies'])) {
return null;
}
$stack = new SplDoublyLinkedList();
foreach ($config['strategies'] as $key => $strategy) {
$arguments = array();
if (is_array($strategy)) {
$name = $key;
$class = static::_strategy($name, static::$_strategies);
$index = (isset($config['strategies'][$name])) ? $name : $class;
$arguments = $config['strategies'][$index];
} else {
$name = $strategy;
$class = static::_strategy($name, static::$_strategies);
}
$stack->push(new $class($arguments));
}
return $stack;
}