/** @var \Magento\Framework\Pricing\Helper\Data */
public $priceData;
/**
* constructor
* @param \Magento\Framework\Pricing\Helper\Data $priceData
*/
public function __construct(
\Magento\Framework\Pricing\Helper\Data $priceData
) {
$this->priceData = $priceData;
}
public function roundPrice($price,$format = true)
{
if ($format) {
return $this->priceData->currency(round($price),true,false);
}else{
return round($price);
}
}
Thanks.