<?php

/*
 * Smarty plugin
 * -------------------------------------------------------------
 * Type:     function
 * Name:     get_contexts
 * Purpose:  get given contexts
 * -------------------------------------------------------------
 */

use KupShop\KupShopBundle\Util\Compat\ServiceContainer;

/**
 * @param array  $params
 * @param Smarty $smarty
 *
 * @return string
 *
 * @throws Exception
 */
function smarty_function_get_price_computer($params, &$smarty)
{
    $priceComputer = ServiceContainer::getService(\KupShop\GTMBundle\Utils\PriceComputer::class);

    if (!empty($params['assign'])) {
        $smarty->assign($params['assign'], $priceComputer);
    } else {
        return $priceComputer;
    }
}
