/** * @param array $recommendations * @return null */ protected function prepareRecommendations($recommendations = array()) { if ($recommendations && is_array($recommendations)) { foreach ($recommendations as $index => $widget) { try { $recommendation = array(); $widgetConfig = $this->bxHelperData->getWidgetConfig($widget['widget']); $recommendation['scenario'] = isset($widget['scenario']) ? $widget['scenario'] : $widgetConfig['scenario']; $recommendation['min'] = isset($widget['min']) ? $widget['min'] : $widgetConfig['min']; $recommendation['max'] = isset($widget['max']) ? $widget['max'] : $widgetConfig['max']; if (isset($widget['context'])) { $recommendation['context'] = explode(',', str_replace(' ', '', $widget['context'])); } else { $recommendation['context'] = $this->getWidgetContext($widgetConfig['scenario']); } $this->p13nHelper->getRecommendation($widget['widget'], $recommendation['context'], $recommendation['scenario'], $recommendation['min'], $recommendation['max'], false); } catch (\Exception $e) { $this->_logger->critical($e); } } } return null; }