28 lines
722 B
PHP
28 lines
722 B
PHP
<?php
|
|
|
|
use KupShop\KupShopBundle\Util\Compat\ServiceContainer;
|
|
use KupShop\OrderingBundle\Util\Order\OrderInfo;
|
|
|
|
/**
|
|
* Smarty plugin.
|
|
*/
|
|
function smarty_function_get_named_vats($params, &$smarty)
|
|
{
|
|
if (!isset($params['vats'])) {
|
|
throw new InvalidArgumentException('Parameter \'vats\' is required!');
|
|
}
|
|
if (!is_array($params['vats'])) {
|
|
throw new InvalidArgumentException('Parameter \'vats\' must be of type array!');
|
|
}
|
|
|
|
$orderInfo = ServiceContainer::getService(OrderInfo::class);
|
|
|
|
$namedVats = $orderInfo->getNamedVats($params['vats']);
|
|
|
|
if (!empty($params['assign'])) {
|
|
$smarty->assign($params['assign'], $namedVats);
|
|
} else {
|
|
return $namedVats;
|
|
}
|
|
}
|