lithium\core\Adaptable::strategies PHP Method

strategies() public static method

Obtain an SplDoublyLinkedList of the strategies for the given $name configuration, using the $_strategies path defined in Adaptable subclasses.
public static strategies ( string $name ) : object
$name string Class name of adapter to load.
return object `SplDoublyLinkedList` of strategies, or `null` if none are defined.
    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) {
            if (!is_array($strategy)) {
                $name = $strategy;
                $class = static::_strategy($name, static::$_strategies);
                $stack->push(new $class());
                continue;
            }
            $class = static::_strategy($key, static::$_strategies);
            $index = isset($config['strategies'][$key]) ? $key : $class;
            $stack->push(new $class($config['strategies'][$index]));
        }
        return $stack;
    }