Cascade\Config\Loader\ClassLoader\HandlerLoader::populateHandlers PHP Method

populateHandlers() private method

Replace the handler or handlers in the option array with the corresponding callable(s) from the array of loaded and callable handlers, if they exist.
private populateHandlers ( array &$handlerOptions, array $handlers )
$handlerOptions array
$handlers array Array of handlers to pick from
    private function populateHandlers(array &$handlerOptions, array $handlers)
    {
        $handlerArray = array();
        if (isset($handlerOptions['handlers'])) {
            foreach ($handlerOptions['handlers'] as $handlerId) {
                if (isset($handlers[$handlerId])) {
                    $handlerArray[] = $handlers[$handlerId];
                } else {
                    throw new \InvalidArgumentException(sprintf('Cannot add handler "%s" to the handler. Handler not found.', $handlerId));
                }
            }
            $handlerOptions['handlers'] = $handlerArray;
        }
        if (isset($handlerOptions['handler'])) {
            $handlerId = $handlerOptions['handler'];
            if (isset($handlers[$handlerId])) {
                $handlerOptions['handler'] = $handlers[$handlerId];
            } else {
                throw new \InvalidArgumentException(sprintf('Cannot add handler "%s" to the handler. Handler not found.', $handlerId));
            }
        }
    }